diff --git a/app/application_native.go b/app/application_native.go index 134d48198..ee285d7a3 100644 --- a/app/application_native.go +++ b/app/application_native.go @@ -101,6 +101,7 @@ type resultWindow struct { // always-on-top, or shortcut capture support. var _ platform.WindowSizer = resultWindow{} var _ fullscreenControl = resultWindow{} +var _ monitorControl = resultWindow{} var _ alwaysOnTopControl = resultWindow{} var _ shortcutCapturer = resultWindow{} var _ titleControl = resultWindow{} @@ -136,6 +137,22 @@ func (window resultWindow) Fullscreen() bool { return ok && control.Fullscreen() } +func (window resultWindow) Monitors() ([]platform.Monitor, error) { + control, ok := window.WindowControl.(monitorControl) + if !ok { + return nil, platform.ErrFullscreenAllMonitorsUnsupported + } + return control.Monitors() +} + +func (window resultWindow) SetFullscreenAllMonitors(fullscreen bool) error { + control, ok := window.WindowControl.(monitorControl) + if !ok { + return platform.ErrFullscreenAllMonitorsUnsupported + } + return control.SetFullscreenAllMonitors(fullscreen) +} + func (window resultWindow) SetTitle(title string) error { control, ok := window.WindowControl.(titleControl) if !ok { @@ -242,19 +259,21 @@ func (host nativeHost) AddStatusItem(config StatusItemConfig) (StatusItemControl if config.Menu != nil { menu = func() []platform.MenuItem { return platformMenu(config.Menu()) } } + var onClick func(platform.StatusClick) + if config.OnClick != nil { + onClick = func(click platform.StatusClick) { + config.OnClick(StatusClick{ + Button: click.Button, + Anchor: StatusAnchor{rect: click.Anchor, set: true}, + PanelDismissed: click.PanelDismissed, + }) + } + } item, err := host.native.AddStatusItem(platform.StatusItemConfig{ Tooltip: config.Tooltip, Icon: config.Icon.platform(), Menu: menu, - OnClick: func(click platform.StatusClick) { - if config.OnClick != nil { - config.OnClick(StatusClick{ - Button: click.Button, - Anchor: StatusAnchor{rect: click.Anchor, set: true}, - PanelDismissed: click.PanelDismissed, - }) - } - }, + OnClick: onClick, }) if err != nil { return nil, err diff --git a/app/capabilities.go b/app/capabilities.go index bf708181b..ab22ed6e6 100644 --- a/app/capabilities.go +++ b/app/capabilities.go @@ -73,6 +73,11 @@ const ( // program with administrator rights after the system's consent prompt. // Only Windows has one. CapabilityElevatedLaunch + // CapabilityClipboardSensitive means SetSensitiveClipboardText can mark + // copied text for exclusion from clipboard history, cloud sync and clipboard + // managers, and clear it again by clipboard sequence or ownership without + // reading the plaintext back. + CapabilityClipboardSensitive ) // Capabilities is a set of platform integrations. diff --git a/app/capabilities_native.go b/app/capabilities_native.go index b6987e5ab..760f53abc 100644 --- a/app/capabilities_native.go +++ b/app/capabilities_native.go @@ -43,5 +43,6 @@ func nativeCapabilities() Capabilities { capabilities |= CapabilityWindowMaximize } capabilities |= capabilityTransparentWindow | capabilityNotificationActivation | capabilityWindowWatermark | capabilityElevatedLaunch + capabilities |= clipboardSensitiveCapability() return Capabilities(capabilities) } diff --git a/app/capabilities_native_test.go b/app/capabilities_native_test.go index 756960d8d..b5a587bdf 100644 --- a/app/capabilities_native_test.go +++ b/app/capabilities_native_test.go @@ -11,6 +11,9 @@ func TestDesktopCapabilitiesKeepSynchronousIntegrations(t *testing.T) { if !Supports(CapabilityClipboardText) { t.Fatal("desktop reports no synchronous clipboard text") } + if !Supports(CapabilityClipboardSensitive) { + t.Fatal("desktop reports no sensitive clipboard support") + } if Supports(CapabilityNotificationPermission) { t.Fatal("desktop reports a browser-style notification permission request") } diff --git a/app/capabilities_web_test.go b/app/capabilities_web_test.go index ed710ae71..e9cd2658d 100644 --- a/app/capabilities_web_test.go +++ b/app/capabilities_web_test.go @@ -8,6 +8,9 @@ func TestWebCapabilitiesExposeAsyncNotSynchronousSystemAPIs(t *testing.T) { if Supports(CapabilityClipboardText) { t.Fatal("the browser reports synchronous clipboard text support") } + if Supports(CapabilityClipboardSensitive) { + t.Fatal("the browser reports sensitive clipboard support") + } if !Supports(CapabilityClipboardTextAsync) { t.Fatal("the browser reports no asynchronous clipboard text support") } diff --git a/app/capability_clipboard_sensitive_linux.go b/app/capability_clipboard_sensitive_linux.go new file mode 100644 index 000000000..37e72b296 --- /dev/null +++ b/app/capability_clipboard_sensitive_linux.go @@ -0,0 +1,15 @@ +//go:build linux && !android + +package app + +import linuxplatform "github.com/vivaui/viva/internal/platform/linux" + +// clipboardSensitiveCapability follows what the running Linux shell can do: the +// GTK shell without gtk_clipboard_set_with_data cannot advertise the password +// manager hint, so SetSensitiveClipboardText would only return ErrUnsupported. +func clipboardSensitiveCapability() Capability { + if linuxplatform.SupportsSensitiveClipboard() { + return CapabilityClipboardSensitive + } + return 0 +} diff --git a/app/capability_clipboard_sensitive_native.go b/app/capability_clipboard_sensitive_native.go new file mode 100644 index 000000000..c32ed02c6 --- /dev/null +++ b/app/capability_clipboard_sensitive_native.go @@ -0,0 +1,7 @@ +//go:build (darwin && !ios) || windows + +package app + +// clipboardSensitiveCapability reports that SetSensitiveClipboardText can mark +// its copy on this desktop. +func clipboardSensitiveCapability() Capability { return CapabilityClipboardSensitive } diff --git a/app/capability_clipboard_sensitive_other.go b/app/capability_clipboard_sensitive_other.go new file mode 100644 index 000000000..ce5a9c16a --- /dev/null +++ b/app/capability_clipboard_sensitive_other.go @@ -0,0 +1,5 @@ +//go:build (!darwin || ios) && !windows && (!linux || android) + +package app + +func clipboardSensitiveCapability() Capability { return 0 } diff --git a/app/clipboard_sensitive.go b/app/clipboard_sensitive.go new file mode 100644 index 000000000..66072ef83 --- /dev/null +++ b/app/clipboard_sensitive.go @@ -0,0 +1,81 @@ +package app + +import ( + "errors" + "fmt" + "strings" + "sync" +) + +// SetSensitiveClipboardText puts secret text on the system clipboard marked so +// clipboard history, cloud clipboard sync and clipboard managers do not record +// it, and returns clear, which empties the clipboard if and only if nothing has +// changed it since this write. +// +// Each desktop marks the copy with the conventions its clipboard managers and +// operating system honour: +// - macOS prepares NSPasteboard with NSPasteboardContentsCurrentHostOnly (kept +// off Universal Clipboard) and adds org.nspasteboard.ConcealedType and +// org.nspasteboard.TransientType beside NSPasteboardTypeString; clear checks +// NSPasteboard.changeCount. +// - Windows writes ExcludeClipboardContentFromMonitorProcessing, +// CanIncludeInClipboardHistory (DWORD 0) and CanUploadToCloudClipboard +// (DWORD 0) in the same clipboard transaction as CF_UNICODETEXT; clear +// checks GetClipboardSequenceNumber while holding the open clipboard. +// - Linux advertises x-kde-passwordManagerHint ("secret") beside UTF8_STRING, +// skips CLIPBOARD_MANAGER hand-off when the owning window closes, and checks +// selection ownership and write generation in clear (or GTK's clipboard +// clear callback under the GTK shell). +// +// Neither SetSensitiveClipboardText nor clear reads clipboard plaintext back. +// Calling clear more than once is harmless: once a call has settled the outcome +// (the clipboard was emptied, or was found changed) later calls report +// (false, nil). A call that fails with an error settles nothing, so clear may be +// called again to retry and the secret is not stranded by a transient failure +// such as a busy clipboard. +// +// Empty strings and strings containing NUL are rejected before touching the +// clipboard. Targets that cannot attach concealment metadata or verify clipboard +// identity without reading the text back (including browsers) return an error +// wrapping ErrUnsupported. +func SetSensitiveClipboardText(value string) (clear func() (cleared bool, err error), err error) { + if value == "" { + return nil, errors.New("app: sensitive clipboard text is empty") + } + if strings.IndexByte(value, 0) >= 0 { + return nil, fmt.Errorf("app: clipboard text contains NUL") + } + if clearFn, err, handled := driverSetSensitiveClipboardText(value); handled { + if err != nil { + return nil, err + } + return onceClear(clearFn), nil + } + clearFn, err := nativeSetSensitiveClipboardText(value) + if err != nil { + return nil, err + } + return onceClear(clearFn), nil +} + +// onceClear makes clearFn idempotent once it reaches a terminal result: it +// emptied the clipboard, or it found the clipboard already changed. An error is +// not terminal, so the next call runs clearFn again. Calls are serialized. +func onceClear(clearFn func() (bool, error)) func() (bool, error) { + var ( + mu sync.Mutex + done bool + ) + return func() (bool, error) { + mu.Lock() + defer mu.Unlock() + if done || clearFn == nil { + return false, nil + } + cleared, err := clearFn() + if err == nil || cleared { + done = true + } + return cleared, err + } +} diff --git a/app/clipboard_sensitive_darwin.go b/app/clipboard_sensitive_darwin.go new file mode 100644 index 000000000..7d6fea4c0 --- /dev/null +++ b/app/clipboard_sensitive_darwin.go @@ -0,0 +1,9 @@ +//go:build darwin && !ios + +package app + +import darwinplatform "github.com/vivaui/viva/internal/platform/darwin" + +func nativeSetSensitiveClipboardText(value string) (func() (bool, error), error) { + return darwinplatform.SetSensitiveClipboardText(value) +} diff --git a/app/clipboard_sensitive_linux.go b/app/clipboard_sensitive_linux.go new file mode 100644 index 000000000..723abe4ac --- /dev/null +++ b/app/clipboard_sensitive_linux.go @@ -0,0 +1,16 @@ +//go:build linux && !android + +package app + +import linuxplatform "github.com/vivaui/viva/internal/platform/linux" + +func nativeSetSensitiveClipboardText(value string) (func() (bool, error), error) { + clearFn, err := linuxplatform.SetSensitiveClipboardText(value) + if err != nil { + return nil, linuxSystemError(err) + } + return func() (bool, error) { + cleared, clearErr := clearFn() + return cleared, linuxSystemError(clearErr) + }, nil +} diff --git a/app/clipboard_sensitive_once_test.go b/app/clipboard_sensitive_once_test.go new file mode 100644 index 000000000..721fb4a49 --- /dev/null +++ b/app/clipboard_sensitive_once_test.go @@ -0,0 +1,51 @@ +package app + +import ( + "errors" + "testing" +) + +// A clear that fails must stay retryable so the secret is not stranded on the +// clipboard; once it reaches a terminal result it must not run again. +func TestOnceClearRetriesAfterErrorThenIsIdempotent(t *testing.T) { + busy := errors.New("clipboard busy") + results := []struct { + cleared bool + err error + }{{false, busy}, {false, busy}, {true, nil}} + calls := 0 + clear := onceClear(func() (bool, error) { + result := results[calls] + calls++ + return result.cleared, result.err + }) + + for attempt := 0; attempt < 2; attempt++ { + if cleared, err := clear(); cleared || !errors.Is(err, busy) { + t.Fatalf("attempt %d: cleared=%v err=%v, want false, busy", attempt, cleared, err) + } + } + if cleared, err := clear(); !cleared || err != nil { + t.Fatalf("retry: cleared=%v err=%v, want true, nil", cleared, err) + } + if cleared, err := clear(); cleared || err != nil { + t.Fatalf("after success: cleared=%v err=%v, want false, nil", cleared, err) + } + if calls != 3 { + t.Fatalf("underlying clear ran %d times, want 3", calls) + } +} + +// Finding the clipboard already changed is terminal too. +func TestOnceClearSettlesWhenClipboardChanged(t *testing.T) { + calls := 0 + clear := onceClear(func() (bool, error) { calls++; return false, nil }) + for range 3 { + if cleared, err := clear(); cleared || err != nil { + t.Fatalf("cleared=%v err=%v, want false, nil", cleared, err) + } + } + if calls != 1 { + t.Fatalf("underlying clear ran %d times, want 1", calls) + } +} diff --git a/app/clipboard_sensitive_other.go b/app/clipboard_sensitive_other.go new file mode 100644 index 000000000..ba0dd509d --- /dev/null +++ b/app/clipboard_sensitive_other.go @@ -0,0 +1,7 @@ +//go:build (!darwin || ios) && !windows && (!linux || android) + +package app + +func nativeSetSensitiveClipboardText(string) (func() (bool, error), error) { + return nil, ErrUnsupported +} diff --git a/app/clipboard_sensitive_test.go b/app/clipboard_sensitive_test.go new file mode 100644 index 000000000..d4c0f0982 --- /dev/null +++ b/app/clipboard_sensitive_test.go @@ -0,0 +1,116 @@ +//go:build darwin || windows || linux + +package app + +import ( + "path/filepath" + "testing" +) + +func TestDriverSensitiveClipboardMarksAndClearsOnlyWhenUnchanged(t *testing.T) { + driver, err := NewDriver(Config{}, nil) + if err != nil { + t.Fatal(err) + } + defer driver.Close() + + clearFn, err := SetSensitiveClipboardText("s3cret-pass-中") + if err != nil { + t.Fatal(err) + } + if !driver.ClipboardSensitive() { + t.Fatal("driver clipboard is not marked sensitive") + } + if got, err := ClipboardText(); err != nil || got != "s3cret-pass-中" { + t.Fatalf("ClipboardText = %q, %v, want secret", got, err) + } + + // First clear while unchanged empties the clipboard and clears the sensitive flag. + cleared, err := clearFn() + if err != nil || !cleared { + t.Fatalf("first clear: cleared=%v err=%v, want true, nil", cleared, err) + } + if driver.ClipboardSensitive() || driver.Clipboard() != "" { + t.Fatalf("after clear: sensitive=%v text=%q, want false / empty", driver.ClipboardSensitive(), driver.Clipboard()) + } + + // Calling the same clear function again is a no-op, even if new text was copied. + if err := SetClipboardText("keep me"); err != nil { + t.Fatal(err) + } + if cleared, err := clearFn(); err != nil || cleared || driver.Clipboard() != "keep me" { + t.Fatalf("second clear call: cleared=%v err=%v text=%q", cleared, err, driver.Clipboard()) + } + + // Every kind of subsequent clipboard write invalidates the pending clear handle. + replacements := []struct { + name string + replace func() + check func() bool + }{ + { + name: "plain text", + replace: func() { _ = SetClipboardText("plain") }, + check: func() bool { return driver.Clipboard() == "plain" }, + }, + { + name: "external driver write", + replace: func() { driver.SetClipboard("from another app") }, + check: func() bool { return driver.Clipboard() == "from another app" }, + }, + { + name: "rich html", + replace: func() { _ = SetClipboardHTML("rich", "rich") }, + check: func() bool { return driver.ClipboardHTML() == "rich" && driver.Clipboard() == "rich" }, + }, + { + name: "image", + replace: func() { _ = driver.SetClipboardImage(onePixelPNG(t)) }, + check: func() bool { return len(driver.ClipboardImage()) > 0 }, + }, + { + name: "files", + replace: func() { driver.SetClipboardFiles([]string{filepath.Join(t.TempDir(), "doc.txt")}) }, + check: func() bool { return driver.Clipboard() == "doc.txt" }, + }, + } + for _, tc := range replacements { + t.Run(tc.name, func(t *testing.T) { + staleClear, err := SetSensitiveClipboardText("ephemeral-secret") + if err != nil { + t.Fatal(err) + } + tc.replace() + if driver.ClipboardSensitive() { + t.Fatal("replacement left ClipboardSensitive true") + } + cleared, err := staleClear() + if err != nil || cleared { + t.Fatalf("stale clear after %s: cleared=%v err=%v, want false, nil", tc.name, cleared, err) + } + if !tc.check() { + t.Fatalf("stale clear mutated %s replacement", tc.name) + } + }) + } +} + +func TestSetSensitiveClipboardTextRejectsEmptyAndNULWithoutMutatingClipboard(t *testing.T) { + driver, err := NewDriver(Config{}, nil) + if err != nil { + t.Fatal(err) + } + defer driver.Close() + + if err := SetClipboardText("existing"); err != nil { + t.Fatal(err) + } + for _, bad := range []string{"", "bad\x00secret"} { + if clearFn, err := SetSensitiveClipboardText(bad); err == nil || clearFn != nil { + t.Fatalf("SetSensitiveClipboardText(%q) = (%v, %v), want nil, error", bad, clearFn != nil, err) + } + } + if driver.Clipboard() != "existing" || driver.ClipboardSensitive() { + t.Fatalf("rejected input mutated clipboard: text=%q sensitive=%v", driver.Clipboard(), driver.ClipboardSensitive()) + } +} diff --git a/app/clipboard_sensitive_windows.go b/app/clipboard_sensitive_windows.go new file mode 100644 index 000000000..c3478cd9c --- /dev/null +++ b/app/clipboard_sensitive_windows.go @@ -0,0 +1,9 @@ +//go:build windows + +package app + +import windowsplatform "github.com/vivaui/viva/internal/platform/windows" + +func nativeSetSensitiveClipboardText(value string) (func() (bool, error), error) { + return windowsplatform.SetSensitiveClipboardText(value) +} diff --git a/app/driver.go b/app/driver.go index db7e68d46..860d3c75d 100644 --- a/app/driver.go +++ b/app/driver.go @@ -47,16 +47,22 @@ type Driver struct { // origin is where Config.Origin put the content area; MoveWindow changes it // as a window manager would. - origin gfx.Point - minimized bool - maximized bool - fullscreen bool - fullscreenRestore gfx.Rect - fullscreenMonitor gfx.Rect - fullscreenChanging bool - fullscreenTarget bool - frameMu sync.Mutex - frame gfx.Rect + origin gfx.Point + minimized bool + maximized bool + fullscreen bool + fullscreenRestore gfx.Rect + fullscreenMonitor gfx.Rect + monitorMu sync.Mutex + monitors []Monitor + // fullscreenSpan is whether the fullscreen window covers every monitor; + // fullscreenSpanTarget is what the request in progress asks for. + fullscreenSpan bool + fullscreenSpanTarget bool + fullscreenChanging bool + fullscreenTarget bool + frameMu sync.Mutex + frame gfx.Rect now time.Duration animating bool @@ -86,6 +92,8 @@ type Driver struct { closed bool appearanceOpen bool clipboardRectangular bool + clipboardSensitive bool + clipboardGeneration uint64 system driverSystem openFilesResponses [driverOpenFilesQueueSize]driverOpenFilesResponse @@ -1063,12 +1071,19 @@ func (driver *Driver) NativeAppearance() Appearance { // returns through gfx.EventResult.ClipboardText. func (driver *Driver) Clipboard() string { return driver.clipboard } +// ClipboardSensitive reports whether the driver's private clipboard currently +// holds concealed text placed there by SetSensitiveClipboardText. Any subsequent +// clipboard write clears it. +func (driver *Driver) ClipboardSensitive() bool { return driver.clipboardSensitive } + // SetClipboard replaces the driver's private clipboard. func (driver *Driver) SetClipboard(value string) { driver.releaseClipboardPromises() + driver.clipboardGeneration++ driver.clipboard, driver.system.clipboardImage, driver.system.clipboardFiles = value, nil, nil driver.system.clipboardHTML = "" driver.clipboardRectangular = false + driver.clipboardSensitive = false } // LastOpenedURL returns the most recent target passed to OpenURL while this diff --git a/app/driver_fullscreen.go b/app/driver_fullscreen.go index f763a8c65..38064055f 100644 --- a/app/driver_fullscreen.go +++ b/app/driver_fullscreen.go @@ -25,14 +25,99 @@ func (driver *Driver) SetFullscreenMonitor(bounds gfx.Rect) error { } driver.fullscreenMonitor = bounds if driver.fullscreen { - return driver.applyFullscreenFrame(bounds) + return driver.applyFullscreenFrame(driver.fullscreenBounds()) } return nil } +// SetMonitors defines the simulated desktop's displays, in device pixels of the +// virtual screen, which SetFullscreenAllMonitors covers with one window. Exactly +// one display is primary and at (0,0), as on a real desktop. Without it the +// desktop has the one display SetFullscreenMonitor describes. +func (driver *Driver) SetMonitors(monitors []Monitor) error { + if driver.closed { + return fmt.Errorf("app: driver is closed") + } + primaries := 0 + for _, monitor := range monitors { + if monitor.Width < 1 || monitor.Height < 1 || monitor.Scale <= 0 { + return fmt.Errorf("app: monitor dimensions and scale must be positive") + } + if monitor.Primary { + primaries++ + if monitor.X != 0 || monitor.Y != 0 { + return fmt.Errorf("app: the primary monitor must be at (0, 0)") + } + } + } + if len(monitors) > 0 && primaries != 1 { + return fmt.Errorf("app: exactly one monitor must be primary") + } + driver.monitorMu.Lock() + driver.monitors = append(driver.monitors[:0], monitors...) + driver.monitorMu.Unlock() + if driver.fullscreen && driver.fullscreenSpan { + return driver.applyFullscreenFrame(driver.fullscreenBounds()) + } + return nil +} + +// Monitors lists the simulated displays, the primary first. Unlike the other +// Driver methods it may be called from any goroutine, as Window.Monitors is. +func (driver *Driver) Monitors() []Monitor { + driver.monitorMu.Lock() + listed := append([]Monitor(nil), driver.monitors...) + driver.monitorMu.Unlock() + if len(listed) > 0 { + return listed + } + scale := driver.displayScale() + bounds := driver.fullscreenMonitor + if bounds.Width == 0 { + bounds = gfx.Rect{Width: 1920, Height: 1080} + } + return []Monitor{{ + X: int(bounds.X * scale), Y: int(bounds.Y * scale), + Width: int(bounds.Width * scale), Height: int(bounds.Height * scale), + Scale: scale, Primary: true, + }} +} + +// fullscreenBounds is the content area a fullscreen window takes, in logical +// pixels: the one monitor, or the box around all of them. +func (driver *Driver) fullscreenBounds() gfx.Rect { + bounds := driver.fullscreenMonitor + if bounds.Width == 0 { + bounds = gfx.Rect{Width: 1920, Height: 1080} + } + if !driver.fullscreenSpan || len(driver.monitors) == 0 { + return bounds + } + left, top, right, bottom := driver.monitors[0].X, driver.monitors[0].Y, 0, 0 + for _, monitor := range driver.monitors { + left, top = min(left, monitor.X), min(top, monitor.Y) + right, bottom = max(right, monitor.X+monitor.Width), max(bottom, monitor.Y+monitor.Height) + } + scale := driver.displayScale() + return gfx.Rect{ + X: float32(left) / scale, Y: float32(top) / scale, + Width: float32(right-left) / scale, Height: float32(bottom-top) / scale, + } +} + +// SetFullscreenAllMonitors is SetFullscreen with the window covering every +// simulated monitor. Leaving is SetFullscreen(false). +func (driver *Driver) SetFullscreenAllMonitors(fullscreen bool) error { + return driver.setFullscreen(fullscreen, fullscreen) +} + // SetFullscreen changes the simulated native state and restores the previous // content placement on exit. Like other Driver methods it is not concurrent. func (driver *Driver) SetFullscreen(fullscreen bool) error { + return driver.setFullscreen(fullscreen, false) +} + +func (driver *Driver) setFullscreen(fullscreen, span bool) error { if driver.closed { return fmt.Errorf("app: driver is closed") } @@ -40,16 +125,24 @@ func (driver *Driver) SetFullscreen(fullscreen bool) error { return err } driver.fullscreenTarget = fullscreen + driver.fullscreenSpanTarget = span if driver.fullscreenChanging { return nil } driver.fullscreenChanging = true defer func() { driver.fullscreenChanging = false }() for driver.fullscreen != driver.fullscreenTarget { + driver.fullscreenSpan = driver.fullscreenSpanTarget if err := driver.transitionFullscreen(driver.fullscreenTarget); err != nil { return err } } + // A window already fullscreen changes between one monitor and all of them + // without leaving, and without replacing the placement restored on exit. + if driver.fullscreen && driver.fullscreenSpan != driver.fullscreenSpanTarget { + driver.fullscreenSpan = driver.fullscreenSpanTarget + return driver.applyFullscreenFrame(driver.fullscreenBounds()) + } return nil } @@ -60,10 +153,7 @@ func (driver *Driver) transitionFullscreen(fullscreen bool) error { bounds := driver.fullscreenRestore if fullscreen { driver.fullscreenRestore = driver.Frame() - bounds = driver.fullscreenMonitor - if bounds.Width == 0 { - bounds = gfx.Rect{Width: 1920, Height: 1080} - } + bounds = driver.fullscreenBounds() } driver.fullscreen = fullscreen driver.painter.fullscreen = fullscreen @@ -90,3 +180,12 @@ func (driver *Driver) applyFullscreenFrame(bounds gfx.Rect) error { // Fullscreen reports the state SetFullscreen last reported. func (driver *Driver) Fullscreen() bool { return driver.fullscreen } + +// displayScale is the simulated display's device pixels per logical pixel, 1 +// while the driver has not been told one. +func (driver *Driver) displayScale() float32 { + if driver.painter.scale > 0 { + return driver.painter.scale + } + return 1 +} diff --git a/app/driver_fullscreen_test.go b/app/driver_fullscreen_test.go index 08ea564db..19818c545 100644 --- a/app/driver_fullscreen_test.go +++ b/app/driver_fullscreen_test.go @@ -214,3 +214,85 @@ func TestFullscreenCallbackCanRequestExitWithoutCorruptingRestore(t *testing.T) t.Fatalf("reentrant exit left invalid state/frame: %v, %+v, %v", driver.Fullscreen(), driver.Frame(), states) } } + +func TestFullscreenAllMonitorsCoversTheBoxAroundEveryMonitor(t *testing.T) { + var events []string + var driver *Driver + var err error + driver, err = NewDriver(Config{Title: "fullscreen", Width: 600, Height: 400, + OnFullscreen: func(bool) { events = append(events, "fullscreen") }, + OnFrameChange: func(gfx.Rect) { + if driver.Fullscreen() { + t.Fatal("a spanning frame was reported as a restorable placement") + } + }, + }, nil) + if err != nil { + t.Fatal(err) + } + defer driver.Close() + scale := driver.displayScale() + // A second display left of the primary and a third below it. + monitors := []Monitor{ + {Width: 1920, Height: 1080, Scale: scale, Primary: true}, + {X: -1280, Width: 1280, Height: 1024, Scale: scale}, + {X: 0, Y: 1080, Width: 1920, Height: 1080, Scale: scale}, + } + if err := driver.SetMonitors(monitors); err != nil { + t.Fatal(err) + } + original := driver.Frame() + if err := driver.SetFullscreenAllMonitors(true); err != nil { + t.Fatal(err) + } + frame := driver.Frame() + want := gfx.Rect{X: -1280 / scale, Y: 0, Width: (1280 + 1920) / scale, Height: 2160 / scale} + if frame != want { + t.Fatalf("spanning frame = %+v, want %+v", frame, want) + } + for _, monitor := range monitors { + x, y := float32(monitor.X)/scale, float32(monitor.Y)/scale + if x < frame.X || y < frame.Y || x+float32(monitor.Width)/scale > frame.X+frame.Width || y+float32(monitor.Height)/scale > frame.Y+frame.Height { + t.Fatalf("monitor %+v is outside the window %+v", monitor, frame) + } + } + // Going back to one monitor does not leave fullscreen or fire another callback. + count := len(events) + if err := driver.SetFullscreen(true); err != nil { + t.Fatal(err) + } + if !driver.Fullscreen() || len(events) != count { + t.Fatalf("narrowing to one monitor left fullscreen or repeated the callback: %v", events) + } + if got := driver.Frame(); got.Width != 1920 || got.Height != 1080 { + t.Fatalf("one-monitor frame = %+v", got) + } + if err := driver.SetFullscreenAllMonitors(true); err != nil { + t.Fatal(err) + } + if err := driver.SetFullscreenAllMonitors(false); err != nil { + t.Fatal(err) + } + if driver.Fullscreen() || driver.Frame() != original { + t.Fatalf("leaving did not restore the placement: %+v, want %+v", driver.Frame(), original) + } +} + +func TestSetMonitorsRejectsAnImpossibleDesktop(t *testing.T) { + driver, err := NewDriver(Config{Title: "monitors", Width: 600, Height: 400}, nil) + if err != nil { + t.Fatal(err) + } + defer driver.Close() + for name, monitors := range map[string][]Monitor{ + "no primary": {{Width: 100, Height: 100, Scale: 1}}, + "two primaries": {{Width: 100, Height: 100, Scale: 1, Primary: true}, {X: 100, Width: 100, Height: 100, Scale: 1, Primary: true}}, + "primary moved": {{X: 5, Width: 100, Height: 100, Scale: 1, Primary: true}}, + "empty monitor": {{Width: 0, Height: 100, Scale: 1, Primary: true}}, + "no scale given": {{Width: 100, Height: 100, Primary: true}}, + } { + if err := driver.SetMonitors(monitors); err == nil { + t.Fatalf("%s was accepted", name) + } + } +} diff --git a/app/driver_system.go b/app/driver_system.go index 85b8d8bd4..575297903 100644 --- a/app/driver_system.go +++ b/app/driver_system.go @@ -106,6 +106,24 @@ func driverSetClipboardText(value string) (error, bool) { return nil, true } +func driverSetSensitiveClipboardText(value string) (func() (bool, error), error, bool) { + system := activeDriverSystem.Load() + if system == nil { + return nil, nil, false + } + driver := system.driver + driver.SetClipboard(value) + driver.clipboardSensitive = true + generation := driver.clipboardGeneration + return func() (bool, error) { + if driver.clipboardGeneration != generation { + return false, nil + } + driver.SetClipboard("") + return true, nil + }, nil, true +} + func driverSetRectangularClipboardText(value string) (error, bool) { system := activeDriverSystem.Load() if system == nil { @@ -130,9 +148,11 @@ func driverClipboardTextWithFormat() (string, bool, error, bool) { // alt as plain text only, like SetClipboard. func (driver *Driver) SetClipboardHTML(html, alt string) { driver.releaseClipboardPromises() + driver.clipboardGeneration++ driver.system.clipboardHTML = html driver.clipboard, driver.system.clipboardImage, driver.system.clipboardFiles = alt, nil, nil driver.clipboardRectangular = false + driver.clipboardSensitive = false } // ClipboardHTML is the rich flavour the driver's private clipboard holds, "" @@ -712,16 +732,20 @@ func driverClipboardImage() (png []byte, err error, handled bool) { func (driver *Driver) SetClipboardImage(png []byte) error { driver.releaseClipboardPromises() if len(png) == 0 { + driver.clipboardGeneration++ driver.system.clipboardImage = nil + driver.clipboardSensitive = false return nil } if err := platform.CheckClipboardPNG(png); err != nil { return err } + driver.clipboardGeneration++ driver.system.clipboardImage = append([]byte(nil), png...) driver.system.clipboardFiles = nil driver.clipboard, driver.system.clipboardHTML = "", "" driver.clipboardRectangular = false + driver.clipboardSensitive = false return nil } @@ -749,6 +773,8 @@ func driverClipboardFiles() (paths []string, err error, handled bool) { // at MaxClipboardFiles. No paths empties the clipboard of files. func (driver *Driver) SetClipboardFiles(paths []string) { driver.releaseClipboardPromises() + driver.clipboardGeneration++ + driver.clipboardSensitive = false if len(paths) == 0 { driver.system.clipboardFiles = nil return @@ -777,11 +803,13 @@ func driverSetClipboardFilePromises(files []FilePromise, released func()) (error } driver := system.driver driver.releaseClipboardPromises() + driver.clipboardGeneration++ system.clipboardPromises = append([]FilePromise(nil), files...) system.promiseReleased = released driver.clipboard, driver.system.clipboardHTML = "", "" driver.system.clipboardImage, driver.system.clipboardFiles = nil, nil driver.clipboardRectangular = false + driver.clipboardSensitive = false return nil, true } @@ -791,10 +819,12 @@ func driverSetClipboardFilePromises(files []FilePromise, released func()) (error // are gone. The slice is copied. func (driver *Driver) SetClipboardFilePromises(files []FilePromise) { driver.releaseClipboardPromises() + driver.clipboardGeneration++ driver.system.clipboardPromises = append([]FilePromise(nil), files...) driver.clipboard, driver.system.clipboardHTML = "", "" driver.system.clipboardImage, driver.system.clipboardFiles = nil, nil driver.clipboardRectangular = false + driver.clipboardSensitive = false } // ClipboardFilePromises is the promises the driver's private clipboard holds, diff --git a/app/driver_system_unsupported.go b/app/driver_system_unsupported.go index 7ea42e214..d9839a367 100644 --- a/app/driver_system_unsupported.go +++ b/app/driver_system_unsupported.go @@ -10,6 +10,10 @@ func driverClipboardText() (string, error, bool) { return "", nil, false } func driverSetClipboardText(string) (error, bool) { return nil, false } +func driverSetSensitiveClipboardText(string) (func() (bool, error), error, bool) { + return nil, nil, false +} + func driverSetRectangularClipboardText(string) (error, bool) { return nil, false } func driverClipboardTextWithFormat() (string, bool, error, bool) { return "", false, nil, false } diff --git a/app/fullscreen_monitors.go b/app/fullscreen_monitors.go new file mode 100644 index 000000000..140e0a7aa --- /dev/null +++ b/app/fullscreen_monitors.go @@ -0,0 +1,73 @@ +package app + +import ( + "errors" + "fmt" + + "github.com/vivaui/viva/internal/platform" +) + +// Monitor is one display of the desktop, in device pixels of the virtual +// screen. The primary display's top-left corner is the origin, so a display +// left of or above it has a negative X or Y. +type Monitor struct { + X, Y, Width, Height int + // Scale is the display's device pixels per logical pixel. + Scale float32 + // Primary marks the display the virtual screen's origin is on. + Primary bool +} + +type monitorControl interface { + Monitors() ([]platform.Monitor, error) + SetFullscreenAllMonitors(bool) error +} + +// Monitors lists the displays of the desktop, the primary one first, then the +// others left to right and top to bottom. It is safe from any goroutine. A +// host that cannot say returns an error wrapping ErrUnsupported. +func (window *Window) Monitors() ([]Monitor, error) { + if window == nil || window.closed.Load() { + return nil, fmt.Errorf("app: window is closed") + } + control, ok := window.control.(monitorControl) + if !ok { + return nil, fmt.Errorf("%w: listing monitors", ErrUnsupported) + } + listed, err := control.Monitors() + if err != nil { + if errors.Is(err, platform.ErrFullscreenAllMonitorsUnsupported) { + return nil, fmt.Errorf("%w: listing monitors", ErrUnsupported) + } + return nil, err + } + monitors := make([]Monitor, len(listed)) + for index, monitor := range listed { + monitors[index] = Monitor(monitor) + } + return monitors, nil +} + +// SetFullscreenAllMonitors makes the window fullscreen across every monitor: +// its content is the bounding box of all of them, as the one picture a remote +// desktop shows over several displays needs. Asking for false leaves +// fullscreen, as SetFullscreen(false) does, and the window may also change +// between one monitor and all of them while it is fullscreen. Like +// SetFullscreen it is safe from any goroutine, reports through OnFullscreen and +// Fullscreen, and means only that the request was accepted. A host that cannot +// span monitors, such as a Wayland compositor, returns an error wrapping +// ErrUnsupported and leaves the window as it was. +func (window *Window) SetFullscreenAllMonitors(fullscreen bool) error { + if window == nil || window.closed.Load() { + return fmt.Errorf("app: window is closed") + } + control, ok := window.control.(monitorControl) + if !ok { + return fmt.Errorf("%w: fullscreen on all monitors", ErrUnsupported) + } + err := control.SetFullscreenAllMonitors(fullscreen) + if errors.Is(err, platform.ErrFullscreenAllMonitorsUnsupported) || errors.Is(err, platform.ErrFullscreenUnsupported) { + return fmt.Errorf("%w: fullscreen on all monitors", ErrUnsupported) + } + return err +} diff --git a/app/fullscreen_test.go b/app/fullscreen_test.go index 618bde292..957ecdc87 100644 --- a/app/fullscreen_test.go +++ b/app/fullscreen_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/vivaui/viva/gfx" + "github.com/vivaui/viva/internal/platform" ) type fullscreenTestControl struct { @@ -107,3 +108,59 @@ func BenchmarkWindowFullscreen(b *testing.B) { } } } + +type monitorTestControl struct { + fullscreenTestControl + listed []platform.Monitor + err error + requests []bool +} + +func (control *monitorTestControl) Monitors() ([]platform.Monitor, error) { + return control.listed, control.err +} + +func (control *monitorTestControl) SetFullscreenAllMonitors(fullscreen bool) error { + control.requests = append(control.requests, fullscreen) + return control.err +} + +func TestWindowMonitorsAndFullscreenAllMonitors(t *testing.T) { + control := &monitorTestControl{listed: []platform.Monitor{ + {Width: 1920, Height: 1080, Scale: 2, Primary: true}, + {X: 1920, Width: 1280, Height: 1024, Scale: 1}, + }} + for name, host := range map[string]WindowControl{"direct": control, "native": resultWindow{WindowControl: control}} { + window := &Window{control: host} + monitors, err := window.Monitors() + if err != nil || len(monitors) != 2 || !monitors[0].Primary || monitors[1].X != 1920 || monitors[0].Scale != 2 { + t.Fatalf("%s: monitors = %+v, %v", name, monitors, err) + } + if err := window.SetFullscreenAllMonitors(true); err != nil { + t.Fatalf("%s: %v", name, err) + } + } + if len(control.requests) != 2 || !control.requests[0] || !control.requests[1] { + t.Fatalf("requests = %v", control.requests) + } + + // A host that cannot span says so as ErrUnsupported and may still list. + control.err = platform.ErrFullscreenAllMonitorsUnsupported + window := &Window{control: control} + if err := window.SetFullscreenAllMonitors(true); !errors.Is(err, ErrUnsupported) { + t.Fatalf("a host that cannot span: %v", err) + } + if _, err := (&Window{control: &fakeWindow{}}).Monitors(); !errors.Is(err, ErrUnsupported) { + t.Fatalf("a host that cannot list: %v", err) + } + if err := (&Window{control: &fakeWindow{}}).SetFullscreenAllMonitors(true); !errors.Is(err, ErrUnsupported) { + t.Fatalf("a host without the control: %v", err) + } + window.closed.Store(true) + if _, err := window.Monitors(); err == nil { + t.Fatal("a closed window listed monitors") + } + if err := window.SetFullscreenAllMonitors(true); err == nil { + t.Fatal("a closed window accepted fullscreen") + } +} diff --git a/app/painter.go b/app/painter.go index ba42e9ed8..4f7e16317 100644 --- a/app/painter.go +++ b/app/painter.go @@ -315,6 +315,7 @@ func (painter *painter) pointerInputOf(event platform.PointerEvent, handled *boo } beforeHovered, beforePressed := painter.pointer.Hovered(), painter.pointer.Pressed() beforeRole, beforeSurface := painter.pointer.HoveredRole(), painter.onSurface + beforeDisabled := painter.pointer.HoveredDisabled() beforeHoverFromLayout := painter.hoverFromLayout && !beforeHovered.IsZero() painter.hoverFromLayout = false beforeFocus, beforeKeyboard := painter.focus.Focused(), painter.focus.KeyboardFocus() @@ -365,6 +366,7 @@ func (painter *painter) pointerInputOf(event platform.PointerEvent, handled *boo if painter.pointer.Hovered() == beforeHovered && painter.pointer.Pressed() == beforePressed && painter.pointer.HoveredRole() == beforeRole && painter.onSurface == beforeSurface && + painter.pointer.HoveredDisabled() == beforeDisabled && !beforeHoverFromLayout && painter.focus.Focused() == beforeFocus && painter.focus.KeyboardFocus() == beforeKeyboard && !focusChanged && !result.Repaint { @@ -437,9 +439,15 @@ func (painter *painter) updateHover(inside, secondaryPress bool) bool { if inside { hit, _, onSurface = painter.focus.Router().PointerAt(painter.pointerAt.X, painter.pointerAt.Y, secondaryPress) } - changed := painter.pointer.Hovered() != hit.Target || painter.pointer.HoveredRole() != hit.Role || painter.onSurface != onSurface + var disabled gfx.ID + if inside { + disabled = painter.focus.Router().DisabledAt(painter.pointerAt.X, painter.pointerAt.Y) + } + changed := painter.pointer.Hovered() != hit.Target || painter.pointer.HoveredRole() != hit.Role || painter.onSurface != onSurface || + painter.pointer.HoveredDisabled() != disabled painter.pointer.SetHovered(hit.Target) painter.pointer.SetHoveredRole(hit.Role) + painter.pointer.SetHoveredDisabled(disabled) painter.onSurface = onSurface return changed } @@ -745,7 +753,7 @@ func (painter *painter) key(event platform.KeyEvent) (platform.Frame, error) { activated = true } painter.focus.Refresh() - if !response.Handled && event.Key == input.KeyTab { + if !response.Handled && (event.Key == input.KeyTab || result.FooterTraversal) { painter.focus.SetKeyboardFocus(!painter.focus.Focused().IsZero()) } focusChanged := painter.applyEventResult(response) @@ -855,13 +863,26 @@ func (painter *painter) focusLostHandler() platform.FocusLostHandler { // activation: it releases the keys that were down and then tells the // application, so the callback sees no key still held. func (painter *painter) deactivateHandler() platform.DeactivateHandler { - if painter.onDeactivate == nil && painter.onKey == nil && painter.onModifierTap == nil { - return nil - } return painter.deactivate } +// activateHandler is what a window hands the platform for gaining the +// activation: the canvas is active again, and one frame restarts what rested +// meanwhile (a text caret), before the application hears of it. +func (painter *painter) activateHandler(next func()) func() { + return func() { + painter.canvas.SetWindowActive(true) + if painter.scheduleFrame != nil { + painter.scheduleFrame(0) + } + if next != nil { + next() + } + } +} + func (painter *painter) deactivate() (platform.Frame, error) { + painter.canvas.SetWindowActive(false) painter.tap.Cancel() repaint := painter.releaseKeys() // The activation takes the pointer too: a press that was down belongs to @@ -1188,6 +1209,7 @@ func (painter *painter) paintCanvas() { painter.canvas.SetInteraction(painter.pointer.Hovered(), painter.pointer.Pressed(), focused, visible) painter.canvas.SetHoverFromLayout(painter.hoverFromLayout) painter.canvas.SetHoveredRole(painter.pointer.HoveredRole()) + painter.canvas.SetHoveredDisabled(painter.pointer.HoveredDisabled()) painter.canvas.SetPointerOnSurface(painter.onSurface) painter.canvas.SetTitlebarInsets(painter.titlebarInsets()) painter.canvas.SetScroll(painter.scrollX, painter.scrollY) @@ -1731,7 +1753,7 @@ func (painter *painter) regionStructuresUnchanged() bool { return painter.diffHits().sameRegions } -// sameRegionHit compares the hit fields Focus.Sync copies into an input.Region. +// sameRegionHit compares the hit fields Focus.Sync uses to rebuild keyboard and pointer routing. // It reads the hits by pointer: a hit is large, and a page has thousands of them. func sameRegionHit(published, current *gfx.Hit) bool { return published.ID == current.ID && @@ -1744,6 +1766,7 @@ func sameRegionHit(published, current *gfx.Hit) bool { published.FocusableDisabled == current.FocusableDisabled && published.SecondaryWhenDisabled == current.SecondaryWhenDisabled && published.SkipTab == current.SkipTab && + published.DialogFooter == current.DialogFooter && published.Block == current.Block && published.BlockSurface == current.BlockSurface && published.Container == current.Container && diff --git a/app/painter_test.go b/app/painter_test.go index 75b64ad7a..e71ff1131 100644 --- a/app/painter_test.go +++ b/app/painter_test.go @@ -1563,6 +1563,59 @@ func TestModalOpenMovesFocusInsideWithinTheSameFrameAndCloseRestoresIt(t *testin } } +func TestDialogShowsInitialButtonFocusUntilAPointerPress(t *testing.T) { + for _, role := range []gfx.Role{gfx.RoleButton, gfx.RoleTextField} { + var canvas gfx.Canvas + opener, initial, scope := gfx.Item(1), gfx.Item(2), gfx.Item(3) + open := false + config := Config{Title: "dialog", Width: 320, Height: 240} + var target gfx.Rect + config.Paint = func(canvas *gfx.Canvas, size gfx.Size) { + canvas.HitWithLabel(opener, gfx.Rect{Width: 32, Height: 24}, "Open") + if open { + dialog := components.BeginDialog(canvas, gfx.LightTheme(), gfx.Rect{Width: size.Width, Height: size.Height}, components.DialogOptions{ + Scope: scope, InitialFocusID: initial, ContentSize: gfx.Size{Width: 220, Height: 168}, + }) + layout := dialog.Begin("Review", "") + target = layout.Footer + canvas.HitWithOptions(initial, target, "Default", gfx.HitOptions{Role: role}) + dialog.End() + } + } + painter := newTestPainter(t, &canvas, config) + if _, err := painter.pointerEvent(platform.PointerEvent{Kind: platform.PointerDown, X: 8, Y: 8}); err != nil { + t.Fatal(err) + } + if _, err := painter.pointerEvent(platform.PointerEvent{Kind: platform.PointerUp, X: 8, Y: 8}); err != nil { + t.Fatal(err) + } + open = true + if _, err := painter.repaint(); err != nil { + t.Fatal(err) + } + if canvas.Focused() != initial || (canvas.FocusVisible() == initial) != (role == gfx.RoleButton) { + t.Fatalf("initial role %v: focus %v, visible %v", role, canvas.Focused(), canvas.FocusVisible()) + } + open = false + if _, err := painter.repaint(); err != nil { + t.Fatal(err) + } + if canvas.Focused() != opener || !canvas.FocusVisible().IsZero() { + t.Fatalf("closing restored focus %v, visible %v", canvas.Focused(), canvas.FocusVisible()) + } + open = true + if _, err := painter.repaint(); err != nil { + t.Fatal(err) + } + if _, err := painter.pointerEvent(platform.PointerEvent{Kind: platform.PointerDown, X: target.X + 1, Y: target.Y + 1}); err != nil { + t.Fatal(err) + } + if canvas.Focused() != initial || !canvas.FocusVisible().IsZero() { + t.Fatalf("press on the dialog control: focus %v, visible %v", canvas.Focused(), canvas.FocusVisible()) + } + } +} + func BenchmarkPainterModalToggle(b *testing.B) { var canvas gfx.Canvas open := false diff --git a/app/run_canvas.go b/app/run_canvas.go index db3443e18..e08b1ed64 100644 --- a/app/run_canvas.go +++ b/app/run_canvas.go @@ -215,7 +215,7 @@ func nativeWindowConfig(normalized *Config, painter *painter) (platform.Config, CaptureMenuKeys: normalized.CaptureMenuKeys, OnAccessibility: painter.accessibilityHandler(normalized), OnFocusLost: painter.focusLostHandler(), - OnActivate: normalized.OnActivate, + OnActivate: painter.activateHandler(normalized.OnActivate), OnDeactivate: painter.deactivateHandler(), OnScroll: scrollHandler, OnFileDrop: dropHandler, diff --git a/app/status_item.go b/app/status_item.go index e59fc5f26..02678bfb7 100644 --- a/app/status_item.go +++ b/app/status_item.go @@ -61,12 +61,11 @@ type StatusItemConfig struct { // OnClick runs on the native event-loop thread for every press of the // item, whatever the button. Opening a window from it is allowed. With a // Menu it runs only for a press the system does not turn into the menu: - // Windows and Linux send primary activation here and open the menu on a - // secondary press. macOS opens the menu for both buttons and does not call - // OnClick while Menu is set. + // primary activation (single or double click) reaches OnClick while a + // secondary press opens the menu. OnClick func(StatusClick) - // Menu supplies the system's own context menu. On Windows a primary press - // also opens it when OnClick is nil. It runs on the event-loop thread each + // Menu supplies the system's own context menu. When OnClick is nil, a + // primary press also opens it. It runs on the event-loop thread each // time the menu is about to open, so the menu shows the application's state // at that moment, and nothing changes it while it is open. Menu func() []MenuItem diff --git a/app/system_js_test.go b/app/system_js_test.go index 461550c78..2a3eb72d0 100644 --- a/app/system_js_test.go +++ b/app/system_js_test.go @@ -36,3 +36,9 @@ func TestBrowserSaveFileWithCheckboxIsUnsupported(t *testing.T) { t.Fatalf("SaveFileWithCheckbox error = %v", err) } } + +func TestBrowserSensitiveClipboardIsUnsupported(t *testing.T) { + if _, err := SetSensitiveClipboardText("secret"); !errors.Is(err, ErrUnsupported) { + t.Fatalf("SetSensitiveClipboardText error = %v", err) + } +} diff --git a/base/accessors.go b/base/accessors.go index b96e86b82..8d0ceca05 100644 --- a/base/accessors.go +++ b/base/accessors.go @@ -980,8 +980,9 @@ func (x *ScrollState) GetBarsAlways() bool { return x.barsAlways } // GetDetached reads the detached of ScrollState for the styled painting layer. func (x *ScrollState) GetDetached() bool { return x.detached } -// GetDragging reads the dragging of ScrollState for the styled painting layer. -func (x *ScrollState) GetDragging() bool { return x.dragging } +// GetDragging reads the dragging of ScrollState for the styled painting layer: +// a held thumb or a held track press, both of which own the pointer. +func (x *ScrollState) GetDragging() bool { return x.Dragging() } // GetFollow reads the follow of ScrollState for the styled painting layer. func (x *ScrollState) GetFollow() bool { return x.follow } diff --git a/base/box.go b/base/box.go index b6b85c8f8..2c7eb2da8 100644 --- a/base/box.go +++ b/base/box.go @@ -714,7 +714,7 @@ func (b Box) ClickModifiers() gfx.Modifiers { // the second of a double click. func (b Box) DoubleClicked() bool { info, ok := b.clickInfo() - return ok && info.Clicks >= 2 + return ok && info.DoubleClick() } func (b Box) clickInfo() (gfx.ClickInfo, bool) { diff --git a/base/caret_blink.go b/base/caret_blink.go index d45b6407a..d1d4de253 100644 --- a/base/caret_blink.go +++ b/base/caret_blink.go @@ -6,14 +6,12 @@ import ( "github.com/vivaui/viva/gfx" ) -// A text caret is lit for CaretBlinkHalf, dark for as long, and keeps going for -// CaretBlinkSpan after the last thing that happened; then it stays lit, so a -// window left alone asks for no frames. The half period matches the terminal -// cursor's, so an application that blinks both does not read as two rhythms. -const ( - CaretBlinkHalf = 530 * time.Millisecond - CaretBlinkSpan = 20 * time.Second -) +// A text caret is lit for CaretBlinkHalf and dark for as long, for as long as it +// is focused in the active window, as every platform's own text field does; a +// window in the background rests lit and asks for no frames. The half period +// matches the terminal cursor's, so an application that blinks both does not +// read as two rhythms. +const CaretBlinkHalf = 530 * time.Millisecond // CaretBlink is the phase of one text caret, held by the application next to // the text it belongs to. It decides whether this frame paints the caret and @@ -35,18 +33,23 @@ type CaretBlink struct { // Lit reports whether the caret is lit in this frame, and asks for the frame // that turns it over. anchor is any value that changes when the caret moves, // such as its byte offset; a different anchor restarts the phase. A canvas -// without a frame clock, a reduced-motion session, and a caret left alone for -// CaretBlinkSpan all stay lit and ask for nothing. +// without a frame clock, a reduced-motion session and a window that is not the +// active one stay lit and ask for nothing. func (blink *CaretBlink) Lit(canvas *gfx.Canvas, anchor int) bool { if !canvas.HasClock() { return true } + if !canvas.WindowActive() { + // The phase restarts lit when the window is active again. + blink.seen = false + return true + } now := canvas.Now() if !blink.seen || blink.anchor != anchor { blink.since, blink.anchor, blink.seen = now, anchor, true } elapsed := max(now-blink.since, 0) - if elapsed >= CaretBlinkSpan || canvas.ReduceMotion() { + if canvas.ReduceMotion() { return true } phase := elapsed % (2 * CaretBlinkHalf) diff --git a/base/caret_blink_test.go b/base/caret_blink_test.go index dce65791d..89a7035f4 100644 --- a/base/caret_blink_test.go +++ b/base/caret_blink_test.go @@ -55,23 +55,31 @@ func TestCaretBlinkAlternatesAndAsksForTheTurnover(t *testing.T) { } } -// A window left alone must not keep asking for frames: after the span the caret -// stays lit and the canvas comes to rest. -func TestCaretBlinkRestsAndStopsAsking(t *testing.T) { +// A focused caret keeps blinking however long it is left alone, as a platform +// text field's does. +func TestCaretBlinkNeverGivesUpWhileActive(t *testing.T) { frames := newCaretFrames() - start := time.Duration(0) - frames.at(start, 3) - - lit, next, scheduled := frames.at(start+CaretBlinkSpan+time.Hour, 3) - if !lit { - t.Fatal("the idle caret is dark; a window left alone must not blink") - } - if scheduled { - t.Fatalf("the idle caret still asks for a frame in %v", next) + frames.at(0, 3) + at := time.Hour + CaretBlinkHalf + time.Millisecond + lit, _, scheduled := frames.at(at, 3) + if lit || !scheduled { + t.Fatalf("an hour later in the dark half: lit=%v scheduled=%v, want dark and a frame asked for", lit, scheduled) } - // It stays at rest on the following frames too. - if _, _, scheduled := frames.at(start+CaretBlinkSpan+2*time.Hour, 3); scheduled { - t.Fatal("the idle caret asked for another frame") +} + +// A window in the background rests lit and asks for no frames; coming back +// restarts the caret lit. +func TestCaretBlinkRestsInAnInactiveWindow(t *testing.T) { + frames := newCaretFrames() + frames.at(0, 3) + frames.canvas.SetWindowActive(false) + lit, next, scheduled := frames.at(CaretBlinkHalf+time.Millisecond, 3) + if !lit || scheduled { + t.Fatalf("inactive window: lit=%v scheduled=%v (next %v), want lit and no frame", lit, scheduled, next) + } + frames.canvas.SetWindowActive(true) + if lit, _, scheduled := frames.at(5*CaretBlinkHalf, 3); !lit || !scheduled { + t.Fatalf("reactivated: lit=%v scheduled=%v, want lit and blinking again", lit, scheduled) } } diff --git a/base/dialog.go b/base/dialog.go index b7e7604b7..fde60d9f6 100644 --- a/base/dialog.go +++ b/base/dialog.go @@ -2,6 +2,7 @@ package base import ( "github.com/vivaui/viva/gfx" + "github.com/vivaui/viva/style" ) // DialogSpec declares a Dialog. The identities are the application's, as with @@ -77,7 +78,8 @@ func (b Box) Header(fn func()) Box { return b.dialogPart(fn, dialogHeaderPart) } func (b Box) Body(fn func()) Box { return b.dialogPart(fn, dialogBodyPart) } // Footer declares the buttons of a Dialog, laid out against its right edge in the -// order given, so the last one sits in the corner. +// order given, so the last one sits in the corner. Left and Right cycle through the +// enabled buttons and Home and End go to the first and last. Each remains a Tab stop. func (b Box) Footer(fn func()) Box { return b.dialogPart(fn, dialogFooterPart) } const ( @@ -99,8 +101,12 @@ func (b Box) dialogPart(fn func(), partKind int) Box { part = d.header case dialogFooterPart: part = d.footer + b.f.Extra(part).focusGroup = dialogFooterButtons } Box{f: b.f, i: part, gen: b.f.gen}.Children(fn) + if partKind == dialogFooterPart { + b.f.minFooterButtons(part) + } WidgetsOf(b.f).layer = saved return b } @@ -123,3 +129,15 @@ func (b Box) Dismissed() bool { spec := &WidgetsOf(b.f).dialogs[n.Aux].spec return b.f.Surface.Clicked(spec.DismissID) || b.f.Surface.Clicked(spec.CloseID) } + +// minFooterButtons gives every button under a dialog's footer, however deeply a +// page nested it, the footer's minimum width unless the page set a width or a floor of its own. +func (f *Frame) minFooterButtons(parent int32) { + for i := f.Nodes[parent].First; i >= 0; i = f.Nodes[i].Next { + n := &f.Nodes[i] + if n.Kind == KindButton && n.MinS[AxisX] == 0 && n.Size[AxisX].Kind == dimAuto { + n.MinS[AxisX] = style.DialogButtonMinWidth + } + f.minFooterButtons(i) + } +} diff --git a/base/elements.go b/base/elements.go index e2db6f99a..660163446 100644 --- a/base/elements.go +++ b/base/elements.go @@ -375,7 +375,7 @@ func Popover(c C, Anchor Box, open *bool, spec PopoverSpec, body func()) bool { } panel := c.f.Popover(Anchor, spec) p.SetScope(panel.i, scope) - panel.Children(func() { + panel.popoverPart(func() { if spec.Title != "" || spec.Description != "" { popoverHeader(c, spec) } diff --git a/base/field.go b/base/field.go index 42885db6d..b78e3c00a 100644 --- a/base/field.go +++ b/base/field.go @@ -455,6 +455,7 @@ func (f *Frame) FieldArea(field *Field, ID gfx.ID, Label, placeholder string) Bo Caret: input.Caret, SelectionStart: input.SelectionStart, SelectionEnd: input.SelectionEnd, SelectionRanges: input.SelectionRanges, CompositionStart: input.CompositionStart, CompositionEnd: input.CompositionEnd, + Blink: input.Blink, }) } diff --git a/base/focus.go b/base/focus.go index a68dee323..dd62f1f0b 100644 --- a/base/focus.go +++ b/base/focus.go @@ -8,7 +8,8 @@ type FocusOrder func(current int, key gfx.Key, count int) (next int, ok bool) type FocusAxis uint8 const ( - FocusHorizontal FocusAxis = iota + 1 // Left and Right - FocusVertical // Up and Down - FocusBoth // all four + FocusHorizontal FocusAxis = iota + 1 // Left and Right + FocusVertical // Up and Down + FocusBoth // all four + dialogFooterButtons // horizontal arrows without coalescing Tab stops ) diff --git a/base/input_base_test.go b/base/input_base_test.go index 24374c123..5b518f0e1 100644 --- a/base/input_base_test.go +++ b/base/input_base_test.go @@ -321,7 +321,7 @@ func TestInputKeepsTheRecipeForWhatTheCallerDidNotSet(t *testing.T) { if r.Color == mine { found = true } - if r.Color == theme.Primary { + if r.Color == theme.Ring { t.Errorf("the recipe's focus border was painted over the caller's: %+v", r) } } @@ -330,8 +330,8 @@ func TestInputKeepsTheRecipeForWhatTheCallerDidNotSet(t *testing.T) { } // A recipe field the caller did not set still follows the state: the focus border. focused := paint(true, func(b Box) Box { return b.Radius(0) }) - if focused.Rectangles()[0].Color != theme.Primary.Over(theme.Background) { - t.Errorf("focused border = %+v, want the recipe's accent", focused.Rectangles()[0].Color) + if focused.Rectangles()[0].Color != theme.Ring.Over(theme.Background) { + t.Errorf("focused border = %+v, want the recipe's ring color", focused.Rectangles()[0].Color) } } diff --git a/base/list.go b/base/list.go index e27287e1d..069fe9fc6 100644 --- a/base/list.go +++ b/base/list.go @@ -1118,7 +1118,7 @@ func (in *listInternals) declareRow(c C, s *ListState, i int, Box Box, row func( // clickRow chooses row as a click with info does. func (s *ListState) clickRow(p *Page, row int, info gfx.ClickInfo) { epoch := p.epoch - if info.Clicks >= 2 { + if info.DoubleClick() { s.submit(row, epoch) } switch { diff --git a/base/paint.go b/base/paint.go index 1d8238250..7e117cf9f 100644 --- a/base/paint.go +++ b/base/paint.go @@ -289,7 +289,11 @@ func (f *Frame) paintElement(i int32) { f.paintBarsFn(f, n, s) // over the content, inside the area's clip } if extra.focusGroup != 0 && canvas != nil { - f.groupFn(f, i, extra.focusGroup, group) + if extra.focusGroup == dialogFooterButtons { + canvas.DialogFooter(group) + } else { + f.groupFn(f, i, extra.focusGroup, group) + } } if extra.tooltip != "" { // The element's hit, which a container, a control or its Draw declared. diff --git a/base/popover.go b/base/popover.go index 69c61081a..6c21901bf 100644 --- a/base/popover.go +++ b/base/popover.go @@ -67,5 +67,16 @@ type PopoverSpec struct { type PopoverDecl struct { spec PopoverSpec Anchor int32 - layer uint16 // the layer the Popover was declared in + layer uint16 // the layer the Popover paints and declares its header and body on +} + +// popoverPart declares fn on the Popover's layer, as dialogPart does for a Dialog: +// a Select, Combobox or Menu in the panel then opens one layer above it, over the +// panel, instead of under it. +func (b Box) popoverPart(fn func()) { + d := &WidgetsOf(b.f).popovers[b.N().Aux] + saved := WidgetsOf(b.f).layer + WidgetsOf(b.f).layer = d.layer + b.Children(fn) + WidgetsOf(b.f).layer = saved } diff --git a/base/radio.go b/base/radio.go index 93de29661..0e278e501 100644 --- a/base/radio.go +++ b/base/radio.go @@ -38,7 +38,7 @@ func radio[T comparable](c C, ID gfx.ID, Value *T, option T, Label string) Box { ring.Alpha *= 0.5 b.Height(m.ControlHeight).Gap(m.GapItem).Children(func() { Row(c).Width(16).Height(16).Shrink(0).Radius(8).Border(1, border).Background(fill). - Items(Center).Justify(Center).StateFrom(b).Focus(Look{}.Border(th.Ring).Ring(3, ring)). + Items(Center).Justify(Center).StateFrom(b).Focus(Look{}.Border(th.Ring).Ring(m.FocusRing(), ring)). Children(func() { if chosen { Row(c).Width(8).Height(8).Radius(4).Background(th.PrimaryForeground) diff --git a/base/scroll.go b/base/scroll.go index 4ebda0b74..cac4b5753 100644 --- a/base/scroll.go +++ b/base/scroll.go @@ -50,8 +50,18 @@ type ScrollState struct { touching bool pullAt time.Duration - ID gfx.ID // the area's identity, which its scrollbars are named under - grab float32 // where along the thumb being dragged the pointer holds it + ID gfx.ID // the area's identity, which its scrollbars are named under + grab float32 // where along the thumb being dragged the pointer holds it + // track is the direction a held press on the bar's track pages: -1 towards the + // start, +1 towards the end, and zero when no track press is held. trackAt is + // when the last page was taken, trackPages how many this press has taken, and + // trackSeen the pointer's place along the track, which a frame that delivers no + // pointer event still reads. + track int8 + trackBar gfx.ID // the bar whose track the press holds, so the other bar leaves it alone + trackAt time.Duration + trackPages int + trackSeen float32 follow bool // Box.Follow: keep the area at its end while the user has not left it detached bool // follow is set and the user scrolled up toEnd bool // ScrollToEnd was called and no layout has honored it yet @@ -135,8 +145,14 @@ func (s *ScrollState) Max() float32 { return max(s.Content-s.Viewport, 0) } // MaxX is how far a Sideways area can scroll left; zero for any other area. func (s *ScrollState) MaxX() float32 { return max(s.ContentWidth-s.ViewportWidth, 0) } -// Dragging reports whether the pointer is dragging one of the area's bars. -func (s *ScrollState) Dragging() bool { return s.dragging } +// Dragging reports whether the pointer holds one of the area's bars: dragging its +// thumb, or paging by holding its track. +func (s *ScrollState) Dragging() bool { return s.dragging || s.track != 0 } + +// endTrack lets a held press on a bar's track go. +func (s *ScrollState) endTrack() { + s.track, s.trackBar, s.trackAt, s.trackPages, s.trackSeen = 0, gfx.ID{}, 0, 0, 0 +} // AtEnd reports whether the area shows its last row, as of the last layout. func (s *ScrollState) AtEnd() bool { return s.Offset >= s.Max()-0.5 } diff --git a/base/scroll_sideways_test.go b/base/scroll_sideways_test.go index ded7a72f2..1d857f1ac 100644 --- a/base/scroll_sideways_test.go +++ b/base/scroll_sideways_test.go @@ -258,12 +258,15 @@ func TestDraggingAScrollbarMovesTheArea(t *testing.T) { t.Errorf("a move after the release was taken, or moved the area from %v to %v", before, state.Offset) } - // A press at the bottom of the bar, below the thumb, brings the thumb there: the end. + // A press at the bottom of the bar, below the thumb, pages towards the pointer: + // one page for the press, and the thumb at the pointer for its paging. p.paint(canvas, gfx.Size{}) + before = state.Offset p.pointer(canvas, vertical, gfx.PointerDown, x, geometry.VerticalTrack.Y+geometry.VerticalTrack.Height-1) p.pointer(canvas, vertical, gfx.PointerUp, x, geometry.VerticalTrack.Y+geometry.VerticalTrack.Height-1) - if state.Offset != state.Max() { - t.Errorf("a press at the bottom of the bar moved the area to %v, want its end %v", state.Offset, state.Max()) + target := geometry.VerticalOffsetForThumb(geometry.VerticalTrack.Y + geometry.VerticalTrack.Height - 1) + if want := min(before+state.Viewport, target); !near(state.Offset, want) { + t.Errorf("a press at the bottom of the bar paged to %v, want %v", state.Offset, want) } // The horizontal bar moves the area across, from where its thumb was taken. @@ -276,8 +279,8 @@ func TestDraggingAScrollbarMovesTheArea(t *testing.T) { if want := geometry.HorizontalOffsetForThumb(thumb.X + 30); !near(state.OffsetX, want) || want <= 0 { t.Errorf("dragged 30 right the area is at %v across, want %v", state.OffsetX, want) } - if state.Offset != state.Max() { - t.Errorf("dragging across moved the area down too, to %v", state.Offset) + if got, want := state.Offset, min(before+state.Viewport, target); !near(got, want) { + t.Errorf("dragging across moved the area down to %v, want %v", got, want) } } diff --git a/base/scrollbar_track_test.go b/base/scrollbar_track_test.go new file mode 100644 index 000000000..fd3bea1f0 --- /dev/null +++ b/base/scrollbar_track_test.go @@ -0,0 +1,292 @@ +package base_test + +import ( + "testing" + "time" + + . "github.com/vivaui/viva/base" + + "github.com/vivaui/viva/components" + "github.com/vivaui/viva/gfx" +) + +// trackArea is a window 100 by 100 holding a vertical ScrollArea of content 300 +// tall, so it has one page and a half of travel: two pages of 100 and a last +// part page that lands the thumb on the pointer. +func trackArea(t *testing.T, content float32) (*wideArea, *gfx.Canvas, *ScrollState, gfx.ID, components.ScrollAreaGeometry) { + t.Helper() + p := &wideArea{area: func(b Box) Box { return b.Scrollbars() }, children: func(f *Frame) { + f.Slot().Width(100).Height(content) + }} + canvas := testCanvas() + p.paint(canvas, gfx.Size{}) + p.paint(canvas, gfx.Size{}) + state := p.View.ScrollState(listID) + vertical := tree.Sub(listID.Scope(), listID.Name()).At(0) + geometry := components.BeginScrollArea(nil, gfx.LightTheme(), gfx.Rect{Width: 100, Height: 100}, gfx.Size{Width: 100, Height: content}). + HoverScrollbars(true).Geometry() + return p, canvas, state, vertical, geometry +} + +// trackFrame paints a frame that delivers no pointer event, as the frames a held +// track press asks for do. +func trackFrame(canvas *gfx.Canvas, p *wideArea) { + canvas.Reset() + p.paint(canvas, gfx.Size{}) +} + +// thumbLimit is the farthest the area may be scrolled with the pointer at x along +// a bar's track while paging towards the end: past it the thumb's end would be +// beyond the pointer. +func thumbLimit(geometry components.ScrollAreaGeometry, pointer float32, vertical bool) float32 { + if vertical { + return geometry.VerticalOffsetForThumb(pointer - geometry.VerticalThumb.Height) + } + return geometry.HorizontalOffsetForThumb(pointer - geometry.HorizontalThumb.Width) +} + +func TestAPressOnTheScrollbarTrackPagesWhileItIsHeld(t *testing.T) { + p, canvas, state, vertical, geometry := trackArea(t, 300) + var at time.Duration + canvas.SetClock(func() time.Duration { return at }) + x := geometry.VerticalTrack.X + 1 + bottom := geometry.VerticalTrack.Y + geometry.VerticalTrack.Height - 1 + limit := thumbLimit(geometry, bottom, true) + + if !p.pointer(canvas, vertical, gfx.PointerDown, x, bottom) { + t.Fatal("a press on the track was not taken") + } + if state.Offset <= 0 || state.Offset > state.Viewport+0.01 { + t.Fatalf("the press paged to %v, want a move of at most one page (%v)", state.Offset, state.Viewport) + } + + // The press is held: the area only moves towards the pointer, never passes + // where the thumb's end meets it, and ends there. + canvas.SetInteraction(gfx.ID{}, vertical, gfx.ID{}, false) + last := state.Offset + for i := 0; i < 6; i++ { + at += ScrollbarTrackDelay + trackFrame(canvas, p) + if state.Offset < last-0.01 || state.Offset > limit+0.01 { + t.Fatalf("frame %d moved the area from %v to %v, want forward and within %v", i, last, state.Offset, limit) + } + last = state.Offset + } + if !nearOffset(t, state.Offset, limit) { + t.Fatalf("the held press stopped at %v, want the thumb's end at the pointer, %v", state.Offset, limit) + } +} + +func TestAHeldTrackPressEndsOnReleaseWithoutPagingAgain(t *testing.T) { + p, canvas, state, vertical, geometry := trackArea(t, 1000) + var at time.Duration + canvas.SetClock(func() time.Duration { return at }) + x := geometry.VerticalTrack.X + 1 + bottom := geometry.VerticalTrack.Y + geometry.VerticalTrack.Height - 1 + + p.pointer(canvas, vertical, gfx.PointerDown, x, bottom) + canvas.SetInteraction(gfx.ID{}, vertical, gfx.ID{}, false) + // The release arrives after the repeat is due: it must not take one more page. + at = 10 * ScrollbarTrackDelay + held := state.Offset + if !p.pointer(canvas, vertical, gfx.PointerUp, x, bottom) { + t.Error("the release of a track press was not taken") + } + if state.Offset != held { + t.Errorf("the release paged the area from %v to %v", held, state.Offset) + } + canvas.SetInteraction(gfx.ID{}, gfx.ID{}, gfx.ID{}, false) + at += 10 * ScrollbarTrackDelay + trackFrame(canvas, p) + if state.Offset != held { + t.Errorf("a frame after the release moved the area from %v to %v", held, state.Offset) + } + if state.Dragging() { + t.Error("the area still reports a held bar after the release") + } +} + +func TestAHeldTrackPressRestsOverTheThumbAndResumesWhenThePointerLeavesIt(t *testing.T) { + p, canvas, state, vertical, geometry := trackArea(t, 300) + var at time.Duration + canvas.SetClock(func() time.Duration { return at }) + x := geometry.VerticalTrack.X + 1 + bottom := geometry.VerticalTrack.Y + geometry.VerticalTrack.Height - 1 + top := geometry.VerticalTrack.Y + 1 + limit := thumbLimit(geometry, bottom, true) + + p.pointer(canvas, vertical, gfx.PointerDown, x, bottom) + canvas.SetInteraction(gfx.ID{}, vertical, gfx.ID{}, false) + for i := 0; i < 4; i++ { + at += ScrollbarTrackDelay + trackFrame(canvas, p) + } + if !nearOffset(t, state.Offset, limit) { + t.Fatalf("the press did not bring the thumb to the pointer: %v, want %v", state.Offset, limit) + } + + // The thumb is under the pointer: moving within it, and the frames that follow, + // leave the area where it is. + at += ScrollbarTrackDelay + p.pointer(canvas, vertical, gfx.PointerMove, x, bottom-1) + trackFrame(canvas, p) + if !nearOffset(t, state.Offset, limit) { + t.Errorf("a pointer over the thumb moved the area to %v", state.Offset) + } + + // The pointer goes far up the track while the press is still held: it pages back. + p.pointer(canvas, vertical, gfx.PointerMove, x, top) + back := state.Offset + if back >= limit-0.01 { + t.Fatalf("a held press whose pointer left the thumb did not resume: offset %v", back) + } + for i := 0; i < 4; i++ { + at += ScrollbarTrackDelay + trackFrame(canvas, p) + if state.Offset > back+0.01 { + t.Fatalf("paging towards the start moved the area forward, %v to %v", back, state.Offset) + } + back = state.Offset + } + if !nearOffset(t, state.Offset, 0) { + t.Errorf("the thumb did not reach the pointer at the start: offset %v", state.Offset) + } + + // And down again: the press is still held, so it pages forwards once more. + p.pointer(canvas, vertical, gfx.PointerMove, x, bottom) + if state.Offset <= 0 { + t.Errorf("the held press did not resume towards the end: offset %v", state.Offset) + } +} + +func TestAHeldTrackPressTurnsAroundWhenThePointerCrossesTheThumb(t *testing.T) { + p, canvas, state, vertical, geometry := trackArea(t, 1000) + var at time.Duration + canvas.SetClock(func() time.Duration { return at }) + x := geometry.VerticalTrack.X + 1 + bottom := geometry.VerticalTrack.Y + geometry.VerticalTrack.Height - 1 + + p.pointer(canvas, vertical, gfx.PointerDown, x, bottom) + canvas.SetInteraction(gfx.ID{}, vertical, gfx.ID{}, false) + if state.Offset == 0 { + t.Fatal("the press did not page at all") + } + + // The pointer moves above the thumb: the paging turns around and the thumb goes + // back to it. + if !p.pointer(canvas, vertical, gfx.PointerMove, x, geometry.VerticalTrack.Y+1) { + t.Fatal("the move over the track was not taken") + } + if !nearOffset(t, state.Offset, 0) { + t.Errorf("with the pointer above the thumb the area is at %v, want its start", state.Offset) + } + + // And a frame after that pages no further, the thumb being at the pointer. + at += 10 * ScrollbarTrackInterval + trackFrame(canvas, p) + if !nearOffset(t, state.Offset, 0) { + t.Errorf("a frame after the turnaround moved the area to %v", state.Offset) + } +} + +func TestAHeldTrackPressEndsWhenThePressGoesAway(t *testing.T) { + p, canvas, state, vertical, geometry := trackArea(t, 1000) + var at time.Duration + canvas.SetClock(func() time.Duration { return at }) + x := geometry.VerticalTrack.X + 1 + bottom := geometry.VerticalTrack.Y + geometry.VerticalTrack.Height - 1 + + p.pointer(canvas, vertical, gfx.PointerDown, x, bottom) + canvas.SetInteraction(gfx.ID{}, vertical, gfx.ID{}, false) + at = ScrollbarTrackDelay + trackFrame(canvas, p) + if state.Offset <= 0 { + t.Fatalf("the held press did not page: offset %v", state.Offset) + } + + // The runtime stops reporting the press: a release that reached another + // control, or a window that deactivated and forgot it. The paging ends with it. + held := state.Offset + canvas.SetInteraction(gfx.ID{}, gfx.ID{}, gfx.ID{}, false) + at += 10 * ScrollbarTrackInterval + trackFrame(canvas, p) + if !nearOffset(t, state.Offset, held) { + t.Errorf("a press that went away kept paging, from %v to %v", held, state.Offset) + } +} + +// nearOffset is the float comparison the scrollbar tests share. +func nearOffset(t *testing.T, got, want float32) bool { + t.Helper() + d := got - want + return d < 0.01 && d > -0.01 +} + +// sidewaysTrack is a window 100 by 100 with content 300 by 300, so both bars +// overflow: the two of them share one ScrollState. +func sidewaysTrack(t *testing.T) (*wideArea, *gfx.Canvas, *ScrollState, gfx.ID, gfx.ID, components.ScrollAreaGeometry) { + t.Helper() + p := &wideArea{area: func(b Box) Box { return b.Sideways().Scrollbars() }, children: func(f *Frame) { + f.Slot().Width(300).Height(300) + }} + canvas := testCanvas() + p.paint(canvas, gfx.Size{}) + p.paint(canvas, gfx.Size{}) + state := p.View.ScrollState(listID) + parts := tree.Sub(listID.Scope(), listID.Name()) + geometry := components.BeginScrollArea(nil, gfx.LightTheme(), gfx.Rect{Width: 100, Height: 100}, gfx.Size{Width: 300, Height: 300}). + HoverScrollbars(true).Geometry() + return p, canvas, state, parts.At(0), parts.At(1), geometry +} + +func TestAPressOnTheTrackPagesByThePageOfItsOwnAxis(t *testing.T) { + p, canvas, state, _, horizontal, geometry := sidewaysTrack(t) + var at time.Duration + canvas.SetClock(func() time.Duration { return at }) + x := geometry.HorizontalTrack.X + geometry.HorizontalTrack.Width - 1 + y := geometry.HorizontalTrack.Y + geometry.HorizontalTrack.Height/2 + limit := thumbLimit(geometry, x, false) + + if !p.pointer(canvas, horizontal, gfx.PointerDown, x, y) { + t.Fatal("a press on the horizontal track was not taken") + } + if state.OffsetX <= 0 || state.OffsetX > state.ViewportWidth+0.01 || state.Offset != 0 { + t.Fatalf("the press paged to %v across and %v down, want at most the area's width %v across only", state.OffsetX, state.Offset, state.ViewportWidth) + } + + // Held: it keeps paging across, only forwards, and stops where the thumb's end + // meets the pointer. + canvas.SetInteraction(gfx.ID{}, horizontal, gfx.ID{}, false) + last := state.OffsetX + for i := 0; i < 6; i++ { + at += ScrollbarTrackDelay + trackFrame(canvas, p) + if state.OffsetX < last-0.01 || state.OffsetX > limit+0.01 { + t.Fatalf("frame %d moved the area across from %v to %v, want forward within %v", i, last, state.OffsetX, limit) + } + last = state.OffsetX + } + if !nearOffset(t, state.OffsetX, limit) || state.Offset != 0 { + t.Errorf("the held press stopped at %v across and %v down, want %v across", state.OffsetX, state.Offset, limit) + } +} + +func TestAHeldTrackPressIsNotEndedByTheAreasOtherBar(t *testing.T) { + p, canvas, state, vertical, _, geometry := sidewaysTrack(t) + var at time.Duration + canvas.SetClock(func() time.Duration { return at }) + x := geometry.VerticalTrack.X + 1 + bottom := geometry.VerticalTrack.Y + geometry.VerticalTrack.Height - 1 + + p.pointer(canvas, vertical, gfx.PointerDown, x, bottom) + if state.Offset == 0 { + t.Fatal("the press did not page at all") + } + canvas.SetInteraction(gfx.ID{}, vertical, gfx.ID{}, false) + paged := state.Offset + at = ScrollbarTrackDelay + trackFrame(canvas, p) + if state.Offset <= paged { + t.Errorf("the area's other bar ended the held press: offset stayed at %v", state.Offset) + } +} diff --git a/base/scrollbars.go b/base/scrollbars.go index bcd0eeefa..472475632 100644 --- a/base/scrollbars.go +++ b/base/scrollbars.go @@ -16,41 +16,192 @@ const ScrollbarLinger = time.Second // their own identity, not a control's. const SlotScrollbarFade uint8 = 200 +// ScrollbarTrackDelay is how long a press on a scrollbar's track waits before it +// pages again. A press released inside it pages once and no further, and a press +// held past it pages once more every ScrollbarTrackInterval, the way the +// scrollbars of a desktop do. +const ScrollbarTrackDelay = 400 * time.Millisecond + +// ScrollbarTrackInterval is the least time between two pages of a held press on a +// scrollbar's track. +const ScrollbarTrackInterval = 100 * time.Millisecond + // dragScrollbar moves an area by the pointer events this paint delivers to one of its -// bars, as a Slider does its thumb: a press on the thumb holds it where it was taken, -// a press beside it brings the middle of the thumb under the pointer, and the press -// drags it until it is let go. The canvas captures the pointer for the press, so the -// moves come to the bar wherever the pointer is. +// bars, as a Slider does its thumb: a press on the thumb holds it where it was taken +// and drags it until it is let go, and a press beside the thumb pages the area +// towards the pointer, repeating while it is held until the thumb reaches the +// pointer and resuming if the pointer moves away from it again. The canvas captures the pointer for the press, so the moves come to the +// bar wherever the pointer is, and a press the runtime stops reporting (a release +// anywhere, a window that deactivated) ends the paging with it. func (f *Frame) DragScrollbar(s *ScrollState, bar gfx.ID, geometry ScrollAreaGeometry, axis int) { - event, ok := f.Surface.PointerOn(bar) - if !ok { - return - } + canvas := f.Surface thumb := geometry.VerticalThumb - pointer, from, length := event.Y, thumb.Y, thumb.Height - if axis == AxisX { + vertical := axis == AxisY + if !vertical { thumb = geometry.HorizontalThumb - pointer, from, length = event.X, thumb.X, thumb.Width } - switch { - case event.Kind == gfx.PointerDown && event.Button <= gfx.PointerButtonPrimary: - s.grab = length / 2 + event, have := canvas.PointerOn(bar) + pointer := s.trackSeen + if have { + pointer = event.Y + if !vertical { + pointer = event.X + } + } + + // A press on the track pages towards the pointer, one page at a time, until the + // thumb reaches it; a pointer that moves to the other side of the thumb turns it + // around. The press holds the capture, so a canvas that no longer reports it held + // has lost it: the paging ends here rather than running on its own. + if s.track != 0 { + if s.trackBar != bar { + return // the area's other bar: the press belongs to this one's sibling + } + // The release is the end of the press, and is taken like the one that lets a + // thumb go: it pages no further. The runtime delivers it while the bar is + // still the pressed one, but a canvas that no longer reports it held has + // lost the press all the same. + if have && event.Kind == gfx.PointerUp { + s.endTrack() + canvas.Consume() + return + } + if canvas.Pressed() != bar { + s.endTrack() + return + } + s.trackSeen = pointer + s.pageToward(canvas, geometry, pointer, vertical) + canvas.Consume() + return + } + + if !have { + return + } + from, length := thumb.Y, thumb.Height + if !vertical { + from, length = thumb.X, thumb.Width + } + pointer = event.Y + if !vertical { + pointer = event.X + } + + if event.Kind == gfx.PointerDown && event.Button <= gfx.PointerButtonPrimary { if pointer >= from && pointer <= from+length { s.grab = pointer - from // taking the thumb does not make it jump + s.dragging = true + if vertical { + s.ScrollTo(geometry.VerticalOffsetForThumb(pointer - s.grab)) + } else { + s.ScrollToX(geometry.HorizontalOffsetForThumb(pointer - s.grab)) + } + canvas.Consume() + return } - s.dragging = true - case event.Kind == gfx.PointerMove && s.dragging: - case event.Kind == gfx.PointerUp && s.dragging: - s.dragging = false - f.Surface.Consume() + // Beside the thumb: page once at once, then keep paging while held. + s.track = 1 + if pointer < from { + s.track = -1 + } + s.trackBar = bar + s.trackSeen = pointer + s.trackPages = 0 + s.trackAt = 0 + s.pageToward(canvas, geometry, pointer, vertical) + canvas.Consume() + return + } + + if !s.dragging { return - default: + } + switch event.Kind { + case gfx.PointerMove: + if vertical { + s.ScrollTo(geometry.VerticalOffsetForThumb(pointer - s.grab)) + } else { + s.ScrollToX(geometry.HorizontalOffsetForThumb(pointer - s.grab)) + } + canvas.Consume() + case gfx.PointerUp: + s.dragging = false + canvas.Consume() + } +} + +// pageToward pages a held press on the track by one page when a page is due. The +// thumb's leading edge is what meets the pointer, as on a desktop: paging down +// stops when the thumb's end reaches the pointer, paging up when its start does. +// While the pointer is over the thumb, or the thumb has reached it, the paging +// rests without ending the press: the press is held until it is let go, so a +// pointer that moves off the thumb again resumes paging towards it. It asks for the +// next frame itself, so the paging runs on the frames it requests and stops with +// them. +func (s *ScrollState) pageToward(canvas *gfx.Canvas, geometry ScrollAreaGeometry, pointer float32, vertical bool) { + from, length, offset := geometry.VerticalThumb.Y, geometry.VerticalThumb.Height, s.Offset + if !vertical { + from, length, offset = geometry.HorizontalThumb.X, geometry.HorizontalThumb.Width, s.OffsetX + } + if pointer >= from && pointer <= from+length { + return // the thumb is under the pointer: nothing to page towards + } + direction := int8(1) + thumbAt := pointer - length // paging towards the end: the thumb's end meets the pointer + if pointer < from { + direction, thumbAt = -1, pointer // towards the start: the thumb's start does + } + var target float32 + if vertical { + target = geometry.VerticalOffsetForThumb(thumbAt) + } else { + target = geometry.HorizontalOffsetForThumb(thumbAt) + } + // The pointer is on the other side of the thumb than the press took it: turn + // around, and page at once on the new side. + if direction != s.track { + s.track = direction + s.trackAt, s.trackPages = 0, 0 + } + // The area is already at the pointer, or past it (the end of the track): rest. + if (direction > 0 && offset >= target) || (direction < 0 && offset <= target) { return } - if axis == AxisY { - s.ScrollTo(geometry.VerticalOffsetForThumb(pointer - s.grab)) + if s.trackAt != 0 { + wait := ScrollbarTrackInterval + if s.trackPages <= 1 { + wait = ScrollbarTrackDelay + } + if elapsed := canvas.Now() - s.trackAt; elapsed < wait { + canvas.RequestFrameIn(wait - elapsed) + return + } + } + page := s.Viewport + if !vertical { + page = s.ViewportWidth + } + if page <= 0 { + page = 1 + } + next := offset + float32(direction)*page + if (direction > 0 && next > target) || (direction < 0 && next < target) { + next = target // the last page lands the thumb on the pointer + } + if vertical { + s.ScrollTo(next) + } else { + s.ScrollToX(next) + } + s.trackPages++ + s.trackAt = canvas.Now() + if next == target { + return // landed: the press stays held, and a pointer that moves away resumes it + } + if s.trackPages <= 1 { + canvas.RequestFrameIn(ScrollbarTrackDelay) } else { - s.ScrollToX(geometry.HorizontalOffsetForThumb(pointer - s.grab)) + canvas.RequestFrameIn(ScrollbarTrackInterval) } - f.Surface.Consume() } diff --git a/base/style.go b/base/style.go index cabbf459f..444d1b903 100644 --- a/base/style.go +++ b/base/style.go @@ -8,7 +8,7 @@ import "github.com/vivaui/viva/gfx" // f.Row().Pad(8).Radius(8).Hit(id, "Open").Transition(). // Hover(ui.Look{}.Background(theme.Hover)). // Pressed(ui.Look{}.Background(theme.Muted)). -// Focus(ui.Look{}.Ring(3, ring)) +// Focus(ui.Look{}.Ring(theme.Metrics.FocusRing(), ring)) // // Hover applies while the pointer is over the element, Pressed while it is held // down, Focused while the keyboard has it however it got there, and Focus while the keyboard has it and the focus is to be seen (the way diff --git a/base/textarea.go b/base/textarea.go index c669e24a3..54139ce7b 100644 --- a/base/textarea.go +++ b/base/textarea.go @@ -110,6 +110,9 @@ type TextareaSnapshot struct { SelectionRanges []text.Span CompositionStart int CompositionEnd int + // Blink is the phase of the caret the component paints itself (see + // HideEditorText): the caret is drawn only while it is lit. Nil keeps it lit. + Blink *CaretBlink } // BottomInset is the room the rows keep free at the bottom of the box: InsetBottom, diff --git a/cmd/viva/templates/accordion.go.txt b/cmd/viva/templates/accordion.go.txt index f31a0e5e6..095b7d1e7 100644 --- a/cmd/viva/templates/accordion.go.txt +++ b/cmd/viva/templates/accordion.go.txt @@ -67,7 +67,8 @@ func (accordion *Accordion) Item(id gfx.ID, title string, open bool, contentHeig if focused { focus := accordion.theme.Ring focus.Alpha *= 0.50 - accordion.canvas.Rounded(expand(header, 3), radius+3, focus) + ring := accordion.theme.Metrics.FocusRing() + accordion.canvas.Rounded(expand(header, ring), radius+ring, focus) } iconSize := float32(16) diff --git a/cmd/viva/templates/alert_dialog.go.txt b/cmd/viva/templates/alert_dialog.go.txt index 27f351feb..52e782bb9 100644 --- a/cmd/viva/templates/alert_dialog.go.txt +++ b/cmd/viva/templates/alert_dialog.go.txt @@ -154,8 +154,10 @@ func (dialog AlertDialog) Begin(title, description, actionLabel, cancelLabel str layout.Body = gfx.Rect{X: textX, Y: min(bodyTop, bodyBottom), Width: textWidth, Height: max(bodyBottom-bodyTop, 0)} layout.Cancel, layout.Action = dialog.actionBounds(footer, actionLabel, cancelLabel) + from := dialog.canvas.Mark() dialog.paintButton(layout.Cancel, cancelLabel, ButtonOutline, dialog.options.CancelID, dialog.cancelDisabled) dialog.paintButton(layout.Action, actionLabel, dialog.options.ActionVariant, dialog.options.ActionID, dialog.actionDisabled) + dialog.canvas.DialogFooter(from) return layout } @@ -171,7 +173,7 @@ func (dialog AlertDialog) End() { if !dialog.options.Scope.IsZero() { dialog.canvas.TrapFocus(dialog.options.Scope) if !dialog.cancelDisabled { - dialog.canvas.SetInitialFocus(dialog.options.InitialFocusID) + setDialogInitialFocus(dialog.canvas, dialog.options.InitialFocusID) } } escapeTarget := dialog.options.CancelID diff --git a/cmd/viva/templates/attachment.go.txt b/cmd/viva/templates/attachment.go.txt index 3fbc3c306..99e3a8daa 100644 --- a/cmd/viva/templates/attachment.go.txt +++ b/cmd/viva/templates/attachment.go.txt @@ -354,7 +354,8 @@ func (attachment Attachment) paintAction(action AttachmentAction, bounds gfx.Rec if canvas.FocusVisible() == action.ID { ring := theme.Ring ring.Alpha *= 0.50 - canvas.Rounded(expand(bounds, 3), radius+3, ring) + focus := theme.Metrics.FocusRing() + canvas.Rounded(expand(bounds, focus), radius+focus, ring) } } tint := theme.Foreground diff --git a/cmd/viva/templates/avatar_editor.go.txt b/cmd/viva/templates/avatar_editor.go.txt index 5d4794b69..e356c999a 100644 --- a/cmd/viva/templates/avatar_editor.go.txt +++ b/cmd/viva/templates/avatar_editor.go.txt @@ -594,7 +594,8 @@ func avatarEditorPaintZoom(c *gfx.Canvas, theme gfx.Theme, id gfx.ID, bounds gfx thumbX := track.X + track.Width*fraction thumb := gfx.Rect{X: thumbX - avatarEditorZoomThumb/2, Y: centerY - avatarEditorZoomThumb/2, Width: avatarEditorZoomThumb, Height: avatarEditorZoomThumb} if c.FocusVisible() == id { - c.Rounded(expand(thumb, 3), avatarEditorZoomThumb/2+3, theme.Ring) + focus := theme.Metrics.FocusRing() + c.Rounded(expand(thumb, focus), avatarEditorZoomThumb/2+focus, theme.Ring) } c.Rounded(thumb, avatarEditorZoomThumb/2, theme.Background) c.RoundedBorder(thumb, avatarEditorZoomThumb/2, 1.5, theme.Primary, gfx.Color{}) diff --git a/cmd/viva/templates/button.go.txt b/cmd/viva/templates/button.go.txt index 828f26b75..ac085c3e4 100644 --- a/cmd/viva/templates/button.go.txt +++ b/cmd/viva/templates/button.go.txt @@ -774,7 +774,8 @@ func buttonRecipe(theme *gfx.Theme, variant ButtonVariant, state gfx.State) Butt } if state.FocusVisible || state.Invalid { ring, border := buttonRing(theme, variant, state.Invalid) - look.Ring, look.RingWidth, look.RingRadius = ring, 3, look.Radius+3 + focus := theme.Metrics.FocusRing() + look.Ring, look.RingWidth, look.RingRadius = ring, focus, look.Radius+focus look.RingOutline = theme.Background.Alpha < 1 look.Border, look.Bordered = border, true } diff --git a/cmd/viva/templates/button_group.go.txt b/cmd/viva/templates/button_group.go.txt index f948a11a4..a756c2eeb 100644 --- a/cmd/viva/templates/button_group.go.txt +++ b/cmd/viva/templates/button_group.go.txt @@ -95,15 +95,16 @@ func (group ButtonGroup) Paint() ButtonGroupResult { framed = framed || option.Variant == ButtonOutline || option.Variant == ButtonDestructiveOutline if !group.disabled && !option.Disabled && !option.ID.IsZero() && group.canvas.FocusVisible() == option.ID { ring, _ := buttonRing(&group.theme, option.Variant, false) - halo := expand(group.optionBounds(index, float32(count)), 3) + focus := group.theme.Metrics.FocusRing() + halo := expand(group.optionBounds(index, float32(count)), focus) // The halo is a disc under an action that paints an opaque fill; an action // with no fill of its own gets it as a line, or the disc would fill the // action's whole surface. style := buttonStyleFor(&group.theme, option.Variant, group.canvas.Hovered() == option.ID, group.canvas.Pressed() == option.ID) if style.filled && style.background.Alpha >= 1 { - group.canvas.Rounded(halo, radius+3, ring) + group.canvas.Rounded(halo, radius+focus, ring) } else { - group.canvas.RoundedOutline(halo, radius+3, 3, ring) + group.canvas.RoundedOutline(halo, radius+focus, focus, ring) } } } diff --git a/cmd/viva/templates/calendar.go.txt b/cmd/viva/templates/calendar.go.txt index 294845eb1..ff9881c52 100644 --- a/cmd/viva/templates/calendar.go.txt +++ b/cmd/viva/templates/calendar.go.txt @@ -283,10 +283,11 @@ func (calendar Calendar) paintDay(bounds gfx.Rect, day CalendarDay) { func (calendar Calendar) paintFocus(bounds gfx.Rect) { ring := calendar.theme.Ring ring.Alpha *= 0.50 + focus := calendar.theme.Metrics.FocusRing() calendar.canvas.Rounded(gfx.Rect{ - X: bounds.X - 3, Y: bounds.Y - 3, - Width: bounds.Width + 6, Height: bounds.Height + 6, - }, calendar.radius()+3, ring) + X: bounds.X - focus, Y: bounds.Y - focus, + Width: bounds.Width + 2*focus, Height: bounds.Height + 2*focus, + }, calendar.radius()+focus, ring) } func (calendar Calendar) radius() float32 { diff --git a/cmd/viva/templates/carousel.go.txt b/cmd/viva/templates/carousel.go.txt index 76f3abac5..81e918609 100644 --- a/cmd/viva/templates/carousel.go.txt +++ b/cmd/viva/templates/carousel.go.txt @@ -323,7 +323,8 @@ func (carousel Carousel) paintControl(bounds gfx.Rect, id gfx.ID, label string, if !disabled && carousel.canvas.FocusVisible() == id { ring := carousel.theme.Ring ring.Alpha *= 0.50 - carousel.canvas.Rounded(carouselExpand(bounds, 3), radius+3, ring) + focus := carousel.theme.Metrics.FocusRing() + carousel.canvas.Rounded(carouselExpand(bounds, focus), radius+focus, ring) } if disabled { background.Alpha *= 0.50 diff --git a/cmd/viva/templates/checkbox.go.txt b/cmd/viva/templates/checkbox.go.txt index 2a5b74c1c..c52b2e801 100644 --- a/cmd/viva/templates/checkbox.go.txt +++ b/cmd/viva/templates/checkbox.go.txt @@ -241,7 +241,8 @@ func checkboxRecipe(theme *gfx.Theme, state gfx.State) CheckboxLook { if state.Invalid { look.Ring = invalidRing(theme) } - look.RingWidth, look.RingRadius = 3*scale, 7*scale + focus := theme.Metrics.FocusRing() * scale + look.RingWidth, look.RingRadius = focus, look.Radius+focus } if state.Disabled { look.Fill.Alpha *= 0.50 diff --git a/cmd/viva/templates/dialog.go.txt b/cmd/viva/templates/dialog.go.txt index 903181157..fea4af183 100644 --- a/cmd/viva/templates/dialog.go.txt +++ b/cmd/viva/templates/dialog.go.txt @@ -94,7 +94,12 @@ func (dialog Dialog) WithoutCloseButton() Dialog { // ) // dialog.End() func (dialog Dialog) Actions(layout DialogLayout, actions ...ButtonAction) { + if dialog.canvas == nil || len(actions) == 0 { + return + } + from := dialog.canvas.Mark() overlayActions(dialog.canvas, dialog.theme, layout.Footer, dialog.options.ButtonSize, dialog.disabled, actions) + dialog.canvas.DialogFooter(from) } // The header, the body and the footer are three item gaps apart, as the `gap-6` @@ -244,7 +249,7 @@ func (dialog Dialog) End() { if !dialog.options.Scope.IsZero() { dialog.canvas.TrapFocus(dialog.options.Scope) if !dialog.disabled { - dialog.canvas.SetInitialFocus(dialog.options.InitialFocusID) + setDialogInitialFocus(dialog.canvas, dialog.options.InitialFocusID) } } escapeTarget := dialog.options.DismissID @@ -261,6 +266,23 @@ func (dialog Dialog) End() { dialog.canvas.PopLayer() } +// A dialog's default action needs a visible keyboard target even when a pointer +// opened it. An editor takes its normal focus, with its caret. +func setDialogInitialFocus(canvas *gfx.Canvas, id gfx.ID) { + visible := false + if !id.IsZero() { + hits := canvas.Hits() + for i := len(hits) - 1; i >= 0; i-- { + hit := &hits[i] + if hit.ID == id && hit.Scope == canvas.FocusScope() && hit.Focusable && !hit.IsLabel { + visible = hit.Role == gfx.RoleButton && !hit.Disabled + break + } + } + } + canvas.SetInitialFocusWithVisibility(id, visible) +} + // contentWidth is the dialog's width: ContentSize.Width, or Vega's `sm:max-w-md` // (448) without one, and never wider than the viewport less a 16px margin. func (dialog Dialog) contentWidth() float32 { diff --git a/cmd/viva/templates/input.go.txt b/cmd/viva/templates/input.go.txt index 1b33faf91..e0fc1a2d5 100644 --- a/cmd/viva/templates/input.go.txt +++ b/cmd/viva/templates/input.go.txt @@ -375,12 +375,6 @@ func inputMaskOffset(value string, offset int) int { return min(count, len(inputBullets)/3) * 3 } -const ( - // inputRing is the width of the focus ring around a button-like control - // (Vega's ring-3). Text-entry controls have none: focus is their border. - inputRing = float32(3) -) - // textEntryDark reports whether theme is a dark appearance, which Vega fills // text-entry controls for (dark:bg-input/30). func textEntryDark(theme *gfx.Theme) bool { return theme.Background.Red < 0.5 } diff --git a/cmd/viva/templates/input_group.go.txt b/cmd/viva/templates/input_group.go.txt index 017d96941..6aac010e7 100644 --- a/cmd/viva/templates/input_group.go.txt +++ b/cmd/viva/templates/input_group.go.txt @@ -350,7 +350,8 @@ func inputGroupPaintButton(canvas *gfx.Canvas, theme gfx.Theme, bounds gfx.Rect, if canvas.FocusVisible() == slot.ID { ring := theme.Ring ring.Alpha *= 0.50 - canvas.Rounded(expand(bounds, inputRing), radius+inputRing, ring) + focus := theme.Metrics.FocusRing() + canvas.Rounded(expand(bounds, focus), radius+focus, ring) } if canvas.Hovered() == slot.ID || canvas.Pressed() == slot.ID { canvas.Rounded(bounds, radius, theme.Accent) diff --git a/cmd/viva/templates/item.go.txt b/cmd/viva/templates/item.go.txt index 6d7d600c0..e90a73b1e 100644 --- a/cmd/viva/templates/item.go.txt +++ b/cmd/viva/templates/item.go.txt @@ -153,7 +153,8 @@ func (item Item) Paint(title, description, trailing string) ItemLayout { if focused { focus := item.theme.Ring focus.Alpha *= 0.50 - item.canvas.RoundedBorder(expand(item.bounds, 3), gfx.RadiusOutset(metrics.RadiusControl, 3), 3, focus, gfx.Color{}) + ring := metrics.FocusRing() + item.canvas.RoundedBorder(expand(item.bounds, ring), gfx.RadiusOutset(metrics.RadiusControl, ring), ring, focus, gfx.Color{}) } background := gfx.Color{} diff --git a/cmd/viva/templates/markdown.go.txt b/cmd/viva/templates/markdown.go.txt index 30df2290a..1154d12ea 100644 --- a/cmd/viva/templates/markdown.go.txt +++ b/cmd/viva/templates/markdown.go.txt @@ -19,6 +19,9 @@ type MarkdownStyle struct { Size float32 // LineHeight is the distance between the lines of body text. LineHeight float32 + // HeadingAlign aligns every visual line of a heading, wrapped ones included. + // The zero value is markdown.AlignLeft. + HeadingAlign markdown.Align // MonoFace is the fixed-pitch family of code. MonoFace gfx.MonoFace // CodeInset keeps this much of the right side of every code block free of @@ -490,7 +493,7 @@ func (v *MarkdownView) Layout(canvas *gfx.Canvas, style MarkdownStyle, doc *mark case markdown.Heading: blkSpan.rowLo = int32(len(v.rowSpans)) l.appendSpans(doc.Spans(b)) - y = l.inline(doc.Spans(b), x0, w, y, l.heading(b.Level, t), markdown.AlignLeft) + y = l.inline(doc.Spans(b), x0, w, y, l.heading(b.Level, t), style.HeadingAlign) blkSpan.rowHi = int32(len(v.rowSpans)) case markdown.Item: indent := float32(b.Level)*markdownListStep + markdownMarkerW diff --git a/cmd/viva/templates/message_scroller.go.txt b/cmd/viva/templates/message_scroller.go.txt index 436f82f99..585fe3999 100644 --- a/cmd/viva/templates/message_scroller.go.txt +++ b/cmd/viva/templates/message_scroller.go.txt @@ -240,7 +240,8 @@ func (scroller MessageScroller) paintButton(bounds gfx.Rect, id gfx.ID, label st if scroller.canvas.FocusVisible() == id { ring := scroller.theme.Ring ring.Alpha *= 0.50 - scroller.canvas.Rounded(messageScrollerExpand(bounds, 3), gfx.RadiusOutset(scroller.theme.Metrics.RadiusControl, 3), ring) + focus := scroller.theme.Metrics.FocusRing() + scroller.canvas.Rounded(messageScrollerExpand(bounds, focus), gfx.RadiusOutset(scroller.theme.Metrics.RadiusControl, focus), ring) } scroller.canvas.RoundedBorder(bounds, scroller.theme.Metrics.RadiusControl, 1, scroller.theme.Border, background) icon := &arrowDownIcon diff --git a/cmd/viva/templates/questionnaire.go.txt b/cmd/viva/templates/questionnaire.go.txt index 4cf1bf414..245e21928 100644 --- a/cmd/viva/templates/questionnaire.go.txt +++ b/cmd/viva/templates/questionnaire.go.txt @@ -193,7 +193,8 @@ func (questionnaire *Questionnaire) AddChoice(choice QuestionnaireChoice) { if focused { ring := theme.Ring ring.Alpha *= 0.50 - canvas.Rounded(expand(bounds, 3), radius+3, ring) + focus := metrics.FocusRing() + canvas.Rounded(expand(bounds, focus), radius+focus, ring) } canvas.RoundedBorder(bounds, radius, 1, border.Over(theme.Background), fill.Over(theme.Background)) diff --git a/cmd/viva/templates/radio_group.go.txt b/cmd/viva/templates/radio_group.go.txt index 5fa1a8522..e50690bc6 100644 --- a/cmd/viva/templates/radio_group.go.txt +++ b/cmd/viva/templates/radio_group.go.txt @@ -213,16 +213,17 @@ func (group RadioGroup) Paint() RadioGroupResult { border = group.theme.Primary fill = group.theme.Primary } + focus := group.theme.Metrics.FocusRing() switch { case option.Invalid && enabled: // The ring is for a control the user can act on; a selected invalid // option keeps its primary border and still shows it. - group.canvas.Rounded(expand(circle, 3), diameter/2+3, invalidRing(&group.theme)) + group.canvas.Rounded(expand(circle, focus), diameter/2+focus, invalidRing(&group.theme)) if !selected { border = invalidBorder(&group.theme) } case focused: - group.canvas.Rounded(expand(circle, 3), diameter/2+3, scaledAlpha(group.theme.Ring, 0.50)) + group.canvas.Rounded(expand(circle, focus), diameter/2+focus, scaledAlpha(group.theme.Ring, 0.50)) if !selected { border = group.theme.Ring } diff --git a/cmd/viva/templates/segmented_control.go.txt b/cmd/viva/templates/segmented_control.go.txt index 8856f890a..43171b738 100644 --- a/cmd/viva/templates/segmented_control.go.txt +++ b/cmd/viva/templates/segmented_control.go.txt @@ -166,11 +166,11 @@ func (control SegmentedControl) Paint() SegmentedControlResult { fill := palette.fill(&control.theme, state) if segmentFocused(state) { // The segment that holds the keyboard, not the whole control. - ring := scaledAlpha(control.theme.Ring, 0.50) + ring, focus := scaledAlpha(control.theme.Ring, 0.50), control.theme.Metrics.FocusRing() if control.theme.Background.Alpha < 1 { - control.canvas.RoundedOutline(segmentedControlExpand(surface, 3), innerRadius+3, 2, ring) + control.canvas.RoundedOutline(segmentedControlExpand(surface, focus), innerRadius+focus, 2, ring) } else { - control.canvas.Rounded(segmentedControlExpand(surface, 3), innerRadius+3, ring) + control.canvas.Rounded(segmentedControlExpand(surface, focus), innerRadius+focus, ring) } paintBordered(control.canvas, control.theme, surface, innerRadius, control.theme.Ring, fill) continue @@ -279,7 +279,7 @@ func SegmentRecipe(theme gfx.Theme, state gfx.State, groupDisabled bool) Segment palette := newSegmentPalette(&theme, groupDisabled) look := SegmentLook{Fill: palette.fill(&theme, state), Foreground: palette.foreground(&theme, state)} if segmentFocused(state) { - look.Border, look.Ring, look.RingWidth = theme.Ring, scaledAlpha(theme.Ring, 0.50), 3 + look.Border, look.Ring, look.RingWidth = theme.Ring, scaledAlpha(theme.Ring, 0.50), theme.Metrics.FocusRing() look.RingOutline = theme.Background.Alpha < 1 } return look diff --git a/cmd/viva/templates/split_button.go.txt b/cmd/viva/templates/split_button.go.txt index 48bff2aa1..7b19ea390 100644 --- a/cmd/viva/templates/split_button.go.txt +++ b/cmd/viva/templates/split_button.go.txt @@ -151,7 +151,8 @@ func (button SplitButton) paintFocus(bounds gfx.Rect, variant ButtonVariant, id return } ring, _ := buttonRing(&button.theme, variant, false) - button.canvas.Rounded(expand(bounds, 3), gfx.RadiusOutset(button.theme.Metrics.RadiusControl, 3), ring) + focus := button.theme.Metrics.FocusRing() + button.canvas.Rounded(expand(bounds, focus), gfx.RadiusOutset(button.theme.Metrics.RadiusControl, focus), ring) } func (button SplitButton) paintHalf(bounds gfx.Rect, index int, variant ButtonVariant, id gfx.ID, framed bool, radius float32) { diff --git a/cmd/viva/templates/switch.go.txt b/cmd/viva/templates/switch.go.txt index 472f0eca2..370e152a8 100644 --- a/cmd/viva/templates/switch.go.txt +++ b/cmd/viva/templates/switch.go.txt @@ -248,7 +248,7 @@ func switchRecipe(theme *gfx.Theme, state gfx.State, progress float32) SwitchLoo if state.Invalid { look.Ring, look.Border = invalidRing(theme), invalidBorder(theme) } - look.RingWidth = 3 + look.RingWidth = theme.Metrics.FocusRing() } if state.Disabled { look.Track.Alpha *= 0.50 diff --git a/cmd/viva/templates/tabs.go.txt b/cmd/viva/templates/tabs.go.txt index 0be4373af..76fa888b9 100644 --- a/cmd/viva/templates/tabs.go.txt +++ b/cmd/viva/templates/tabs.go.txt @@ -514,7 +514,8 @@ func tabTriggerRecipe(theme *gfx.Theme, variant TabsVariant, state gfx.State) Ta if !state.Disabled && state.FocusVisible { look.Ring = theme.Ring look.Ring.Alpha *= 0.50 - look.RingWidth, look.RingRadius = 3, radius+3 + focus := theme.Metrics.FocusRing() + look.RingWidth, look.RingRadius = focus, radius+focus } if state.Selected && variant == TabsDefault { fill := theme.Background diff --git a/cmd/viva/templates/toggle.go.txt b/cmd/viva/templates/toggle.go.txt index 392c70e61..417cc6445 100644 --- a/cmd/viva/templates/toggle.go.txt +++ b/cmd/viva/templates/toggle.go.txt @@ -57,7 +57,8 @@ func ToggleRecipe(theme gfx.Theme, variant ToggleVariant, state gfx.State) style if state.Invalid { ring, edge = invalidRing(&theme), invalidBorder(&theme) } - look.Ring, look.RingWidth, look.RingRadius = ring, 3, radius+3 + focus := theme.Metrics.FocusRing() + look.Ring, look.RingWidth, look.RingRadius = ring, focus, radius+focus look.Border, look.Bordered = edge, true } if state.Disabled { diff --git a/cmd/viva/templates/toggle_group.go.txt b/cmd/viva/templates/toggle_group.go.txt index ebc18234d..1d187bf32 100644 --- a/cmd/viva/templates/toggle_group.go.txt +++ b/cmd/viva/templates/toggle_group.go.txt @@ -291,7 +291,8 @@ func (group ToggleGroup) Paint() ToggleGroupResult { pressed := enabled && group.canvas.Pressed() == option.ID focused := enabled && group.canvas.FocusVisible() == option.ID if focused { - group.canvas.Rounded(expand(bounds, 3), radius+3, scaledAlpha(group.theme.Ring, 0.50)) + focus := group.theme.Metrics.FocusRing() + group.canvas.Rounded(expand(bounds, focus), radius+focus, scaledAlpha(group.theme.Ring, 0.50)) } fill := group.theme.Background fill.Alpha = 0 diff --git a/components/accordion.go b/components/accordion.go index 0393e52a4..48c34e687 100644 --- a/components/accordion.go +++ b/components/accordion.go @@ -67,7 +67,8 @@ func (accordion *Accordion) Item(id gfx.ID, title string, open bool, contentHeig if focused { focus := accordion.theme.Ring focus.Alpha *= 0.50 - accordion.canvas.Rounded(expand(header, 3), radius+3, focus) + ring := accordion.theme.Metrics.FocusRing() + accordion.canvas.Rounded(expand(header, ring), radius+ring, focus) } iconSize := float32(16) diff --git a/components/alert_dialog.go b/components/alert_dialog.go index c4207d9c6..d2c3253f5 100644 --- a/components/alert_dialog.go +++ b/components/alert_dialog.go @@ -154,8 +154,10 @@ func (dialog AlertDialog) Begin(title, description, actionLabel, cancelLabel str layout.Body = gfx.Rect{X: textX, Y: min(bodyTop, bodyBottom), Width: textWidth, Height: max(bodyBottom-bodyTop, 0)} layout.Cancel, layout.Action = dialog.actionBounds(footer, actionLabel, cancelLabel) + from := dialog.canvas.Mark() dialog.paintButton(layout.Cancel, cancelLabel, ButtonOutline, dialog.options.CancelID, dialog.cancelDisabled) dialog.paintButton(layout.Action, actionLabel, dialog.options.ActionVariant, dialog.options.ActionID, dialog.actionDisabled) + dialog.canvas.DialogFooter(from) return layout } @@ -171,7 +173,7 @@ func (dialog AlertDialog) End() { if !dialog.options.Scope.IsZero() { dialog.canvas.TrapFocus(dialog.options.Scope) if !dialog.cancelDisabled { - dialog.canvas.SetInitialFocus(dialog.options.InitialFocusID) + setDialogInitialFocus(dialog.canvas, dialog.options.InitialFocusID) } } escapeTarget := dialog.options.CancelID diff --git a/components/alert_dialog_test.go b/components/alert_dialog_test.go index cccc6e92e..4daf7c5dc 100644 --- a/components/alert_dialog_test.go +++ b/components/alert_dialog_test.go @@ -46,7 +46,7 @@ func TestAlertDialogUsesModalScopeLayerAndTypedButtons(t *testing.T) { t.Fatalf("hits = %+v", canvas.Hits()) } for _, hit := range canvas.Hits() { - if hit.Scope != gfx.Item(9) || hit.Role != gfx.RoleButton || !hit.Focusable { + if hit.Scope != gfx.Item(9) || hit.Role != gfx.RoleButton || !hit.Focusable || hit.DialogFooter != gfx.Item(11) { t.Fatalf("button hit = %+v", hit) } } diff --git a/components/attachment.go b/components/attachment.go index b472570bf..421ff6959 100644 --- a/components/attachment.go +++ b/components/attachment.go @@ -354,7 +354,8 @@ func (attachment Attachment) paintAction(action AttachmentAction, bounds gfx.Rec if canvas.FocusVisible() == action.ID { ring := theme.Ring ring.Alpha *= 0.50 - canvas.Rounded(expand(bounds, 3), radius+3, ring) + focus := theme.Metrics.FocusRing() + canvas.Rounded(expand(bounds, focus), radius+focus, ring) } } tint := theme.Foreground diff --git a/components/avatar_editor.go b/components/avatar_editor.go index 2c37f0bb4..7019b91f7 100644 --- a/components/avatar_editor.go +++ b/components/avatar_editor.go @@ -594,7 +594,8 @@ func avatarEditorPaintZoom(c *gfx.Canvas, theme gfx.Theme, id gfx.ID, bounds gfx thumbX := track.X + track.Width*fraction thumb := gfx.Rect{X: thumbX - avatarEditorZoomThumb/2, Y: centerY - avatarEditorZoomThumb/2, Width: avatarEditorZoomThumb, Height: avatarEditorZoomThumb} if c.FocusVisible() == id { - c.Rounded(expand(thumb, 3), avatarEditorZoomThumb/2+3, theme.Ring) + focus := theme.Metrics.FocusRing() + c.Rounded(expand(thumb, focus), avatarEditorZoomThumb/2+focus, theme.Ring) } c.Rounded(thumb, avatarEditorZoomThumb/2, theme.Background) c.RoundedBorder(thumb, avatarEditorZoomThumb/2, 1.5, theme.Primary, gfx.Color{}) diff --git a/components/button.go b/components/button.go index b2920c14c..29bf16176 100644 --- a/components/button.go +++ b/components/button.go @@ -333,7 +333,7 @@ func (row ButtonRow) Paint(actions ...ButtonAction) { } gaps := row.theme.Metrics.GapItem * float32(len(actions)-1) fitted := func(action ButtonAction) float32 { - return row.button(gfx.ID{}, area).SizeToFit(action.Label).BoundsWidth() + return max(row.button(gfx.ID{}, area).SizeToFit(action.Label).BoundsWidth(), style.DialogButtonMinWidth) } var labels float32 for _, action := range actions { @@ -774,7 +774,8 @@ func buttonRecipe(theme *gfx.Theme, variant ButtonVariant, state gfx.State) Butt } if state.FocusVisible || state.Invalid { ring, border := buttonRing(theme, variant, state.Invalid) - look.Ring, look.RingWidth, look.RingRadius = ring, 3, look.Radius+3 + focus := theme.Metrics.FocusRing() + look.Ring, look.RingWidth, look.RingRadius = ring, focus, look.Radius+focus look.RingOutline = theme.Background.Alpha < 1 look.Border, look.Bordered = border, true } diff --git a/components/button_group.go b/components/button_group.go index c3a62bfb4..7972d7c59 100644 --- a/components/button_group.go +++ b/components/button_group.go @@ -95,15 +95,16 @@ func (group ButtonGroup) Paint() ButtonGroupResult { framed = framed || option.Variant == ButtonOutline || option.Variant == ButtonDestructiveOutline if !group.disabled && !option.Disabled && !option.ID.IsZero() && group.canvas.FocusVisible() == option.ID { ring, _ := buttonRing(&group.theme, option.Variant, false) - halo := expand(group.optionBounds(index, float32(count)), 3) + focus := group.theme.Metrics.FocusRing() + halo := expand(group.optionBounds(index, float32(count)), focus) // The halo is a disc under an action that paints an opaque fill; an action // with no fill of its own gets it as a line, or the disc would fill the // action's whole surface. style := buttonStyleFor(&group.theme, option.Variant, group.canvas.Hovered() == option.ID, group.canvas.Pressed() == option.ID) if style.filled && style.background.Alpha >= 1 { - group.canvas.Rounded(halo, radius+3, ring) + group.canvas.Rounded(halo, radius+focus, ring) } else { - group.canvas.RoundedOutline(halo, radius+3, 3, ring) + group.canvas.RoundedOutline(halo, radius+focus, focus, ring) } } } diff --git a/components/button_test.go b/components/button_test.go index b95e84ac2..ec96a4d24 100644 --- a/components/button_test.go +++ b/components/button_test.go @@ -157,8 +157,8 @@ func TestButtonFocusAndInvalidRingsUseOfficialTokensInDark(t *testing.T) { focusRing := focused.Rectangles()[0] wantFocus := theme.Ring wantFocus.Alpha *= 0.50 - if focusRing.Color != wantFocus || focusRing.Bounds != (gfx.Rect{X: 1, Y: 1, Width: 106, Height: 38}) { - t.Fatalf("focus ring = %+v, want Ring/50 expanded 3px", focusRing) + if focusRing.Color != wantFocus || focusRing.Bounds != expand(gfx.Rect{X: 4, Y: 4, Width: 100, Height: theme.Metrics.ControlHeight}, theme.Metrics.FocusRing()) { + t.Fatalf("focus ring = %+v, want Ring/50 expanded by the focus ring metric", focusRing) } // The dark outline's surface is a translucent input tint, so nothing covers the // middle of a ring disc: the invalid ring is the danger token drawn as a line, and diff --git a/components/calendar.go b/components/calendar.go index 86e2fd1be..04c279b83 100644 --- a/components/calendar.go +++ b/components/calendar.go @@ -283,10 +283,11 @@ func (calendar Calendar) paintDay(bounds gfx.Rect, day CalendarDay) { func (calendar Calendar) paintFocus(bounds gfx.Rect) { ring := calendar.theme.Ring ring.Alpha *= 0.50 + focus := calendar.theme.Metrics.FocusRing() calendar.canvas.Rounded(gfx.Rect{ - X: bounds.X - 3, Y: bounds.Y - 3, - Width: bounds.Width + 6, Height: bounds.Height + 6, - }, calendar.radius()+3, ring) + X: bounds.X - focus, Y: bounds.Y - focus, + Width: bounds.Width + 2*focus, Height: bounds.Height + 2*focus, + }, calendar.radius()+focus, ring) } func (calendar Calendar) radius() float32 { diff --git a/components/calendar_test.go b/components/calendar_test.go index 1b2f65c8b..520b4e870 100644 --- a/components/calendar_test.go +++ b/components/calendar_test.go @@ -126,7 +126,7 @@ func TestCalendarFocusedDayUsesRingAndPreservesTypedSemantics(t *testing.T) { calendar.Paint() focusedBounds := calendar.DayBounds(5) - wantRingBounds := gfx.Rect{X: focusedBounds.X - 3, Y: focusedBounds.Y - 3, Width: 34, Height: 34} + wantRingBounds := expand(focusedBounds, theme.Metrics.FocusRing()) foundRing := false for _, rectangle := range canvas.Rectangles() { if rectangle.Bounds == wantRingBounds { diff --git a/components/caret_blink.go b/components/caret_blink.go index 2de51e4c3..017608071 100644 --- a/components/caret_blink.go +++ b/components/caret_blink.go @@ -6,7 +6,4 @@ import "github.com/vivaui/viva/base" // snapshots can name it without the engine depending on a design system. type CaretBlink = base.CaretBlink -const ( - CaretBlinkHalf = base.CaretBlinkHalf - CaretBlinkSpan = base.CaretBlinkSpan -) +const CaretBlinkHalf = base.CaretBlinkHalf diff --git a/components/carousel.go b/components/carousel.go index f540b9572..f298c5baf 100644 --- a/components/carousel.go +++ b/components/carousel.go @@ -323,7 +323,8 @@ func (carousel Carousel) paintControl(bounds gfx.Rect, id gfx.ID, label string, if !disabled && carousel.canvas.FocusVisible() == id { ring := carousel.theme.Ring ring.Alpha *= 0.50 - carousel.canvas.Rounded(carouselExpand(bounds, 3), radius+3, ring) + focus := carousel.theme.Metrics.FocusRing() + carousel.canvas.Rounded(carouselExpand(bounds, focus), radius+focus, ring) } if disabled { background.Alpha *= 0.50 diff --git a/components/checkbox.go b/components/checkbox.go index 62e1d35e7..829e75643 100644 --- a/components/checkbox.go +++ b/components/checkbox.go @@ -241,7 +241,8 @@ func checkboxRecipe(theme *gfx.Theme, state gfx.State) CheckboxLook { if state.Invalid { look.Ring = invalidRing(theme) } - look.RingWidth, look.RingRadius = 3*scale, 7*scale + focus := theme.Metrics.FocusRing() * scale + look.RingWidth, look.RingRadius = focus, look.Radius+focus } if state.Disabled { look.Fill.Alpha *= 0.50 diff --git a/components/checkbox_test.go b/components/checkbox_test.go index e49911fdb..259174dd5 100644 --- a/components/checkbox_test.go +++ b/components/checkbox_test.go @@ -146,7 +146,7 @@ func TestCheckboxFocusAndInvalidUseOfficialRings(t *testing.T) { wantFocus := theme.Ring wantFocus.Alpha *= 0.50 - if ring := focused.Rectangles()[0]; ring.Color != wantFocus || ring.Bounds != (gfx.Rect{X: 1, Y: 1, Width: 22, Height: 22}) { + if ring := focused.Rectangles()[0]; ring.Color != wantFocus || ring.Bounds != expand(gfx.Rect{X: 4, Y: 4, Width: 16, Height: 16}, theme.Metrics.FocusRing()*theme.Metrics.ControlHeight/32) { t.Fatalf("focus ring = %+v", ring) } wantInvalid := withAlpha(theme.Danger, 0.40) diff --git a/components/code_editor_test.go b/components/code_editor_test.go index 73e147072..ed0fdd240 100644 --- a/components/code_editor_test.go +++ b/components/code_editor_test.go @@ -71,9 +71,6 @@ func TestCodeEditorCaretBlinksByDefaultAndStopsWhenInactive(t *testing.T) { if lit, _ := frame(2*CaretBlinkHalf + 6*time.Millisecond); !lit { t.Fatal("regaining focus must restart the caret lit") } - if lit, scheduled := frame(CaretBlinkSpan + 3*CaretBlinkHalf); !lit || scheduled { - t.Fatal("a caret left alone must settle lit without idle frames") - } } func BenchmarkCodeEditorPaintBlink(b *testing.B) { diff --git a/components/dialog.go b/components/dialog.go index 8dba06217..82f9e35ab 100644 --- a/components/dialog.go +++ b/components/dialog.go @@ -94,7 +94,12 @@ func (dialog Dialog) WithoutCloseButton() Dialog { // ) // dialog.End() func (dialog Dialog) Actions(layout DialogLayout, actions ...ButtonAction) { + if dialog.canvas == nil || len(actions) == 0 { + return + } + from := dialog.canvas.Mark() overlayActions(dialog.canvas, dialog.theme, layout.Footer, dialog.options.ButtonSize, dialog.disabled, actions) + dialog.canvas.DialogFooter(from) } // The header, the body and the footer are three item gaps apart, as the `gap-6` @@ -244,7 +249,7 @@ func (dialog Dialog) End() { if !dialog.options.Scope.IsZero() { dialog.canvas.TrapFocus(dialog.options.Scope) if !dialog.disabled { - dialog.canvas.SetInitialFocus(dialog.options.InitialFocusID) + setDialogInitialFocus(dialog.canvas, dialog.options.InitialFocusID) } } escapeTarget := dialog.options.DismissID @@ -261,6 +266,23 @@ func (dialog Dialog) End() { dialog.canvas.PopLayer() } +// A dialog's default action needs a visible keyboard target even when a pointer +// opened it. An editor takes its normal focus, with its caret. +func setDialogInitialFocus(canvas *gfx.Canvas, id gfx.ID) { + visible := false + if !id.IsZero() { + hits := canvas.Hits() + for i := len(hits) - 1; i >= 0; i-- { + hit := &hits[i] + if hit.ID == id && hit.Scope == canvas.FocusScope() && hit.Focusable && !hit.IsLabel { + visible = hit.Role == gfx.RoleButton && !hit.Disabled + break + } + } + } + canvas.SetInitialFocusWithVisibility(id, visible) +} + // contentWidth is the dialog's width: ContentSize.Width, or Vega's `sm:max-w-md` // (448) without one, and never wider than the viewport less a 16px margin. func (dialog Dialog) contentWidth() float32 { diff --git a/components/dialog_test.go b/components/dialog_test.go index 975218183..0947d2b65 100644 --- a/components/dialog_test.go +++ b/components/dialog_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/vivaui/viva/gfx" + "github.com/vivaui/viva/style" ) func TestDialogPaintsCenteredModalLayerAndTypedActions(t *testing.T) { @@ -165,6 +166,7 @@ func TestDialogActionsFitTheirLabelsAndSitAtTheFooterCorner(t *testing.T) { } for index, label := range []string{"Cancel", "Add Host"} { want := BeginButton(canvas, theme, gfx.ID{}, layout.Footer).SizeToFit(label).BoundsWidth() + want = max(want, style.DialogButtonMinWidth) if got := hits[index].Bounds.Width; got != want { t.Errorf("%q button is %v wide, want %v: just its label and padding", label, got, want) } @@ -197,6 +199,7 @@ func TestDialogActionsFollowTheLabelAcrossLanguagesAndDensities(t *testing.T) { } for index, hit := range hits { want := BeginButton(canvas, theme, gfx.ID{}, layout.Footer).SizeToFit(labels[index]).BoundsWidth() + want = max(want, style.DialogButtonMinWidth) if hit.Bounds.Width != want { t.Errorf("density %v, %q: width %v, want %v", density, labels[index], hit.Bounds.Width, want) } @@ -235,6 +238,9 @@ func TestDialogActionsVariantsDisabledAndDisabledDialogs(t *testing.T) { if hits[0].Disabled || !hits[1].Disabled { t.Errorf("per-action Disabled not honored: %+v", hits) } + if hits[0].DialogFooter != hits[0].ID || !hits[1].DialogFooter.IsZero() { + t.Errorf("footer navigation includes the wrong buttons: %+v", hits) + } canvas, _ = footerActions(t, gfx.DarkTheme(), true, 460, ButtonAction{ID: gfx.Item(31), Label: "Cancel"}, ButtonAction{ID: gfx.Item(32), Label: "OK"}) for _, hit := range actionHits(canvas, 31, 32) { if !hit.Disabled { diff --git a/components/doc.go b/components/doc.go index 3e66df071..c481ef5f5 100644 --- a/components/doc.go +++ b/components/doc.go @@ -149,8 +149,8 @@ // position can be read and set, and offsets map to and from vertical // positions (`CodeEditor.YAtOffset`), for views kept scrolled together. // - Caret blink: `CaretBlink` holds the phase of one text caret, so a focused -// editor's caret turns over on the terminal's rhythm and comes to rest lit -// when the window is left alone. The application keeps one next to its text +// editor's caret turns over on the terminal's rhythm and rests lit while the +// window is not the active one. The application keeps one next to its text // and passes the result as ShowCaret. // - Text selection: a drag that begins in one painted text and ends in another // (a MarkdownView, a table, a plain block) is followed by ui.TextSelection, diff --git a/components/dock.go b/components/dock.go new file mode 100644 index 000000000..5f849b2f0 --- /dev/null +++ b/components/dock.go @@ -0,0 +1,245 @@ +package components + +import "github.com/vivaui/viva/gfx" + +// DockEdge is the edge of a window's content area a panel is docked to. +type DockEdge uint8 + +const ( + DockLeft DockEdge = iota + DockRight + DockBottom +) + +// DockPanel declares one panel docked beside the content. +type DockPanel struct { + Edge DockEdge + // Extent is the preferred size across the edge: the width of a panel on the + // left or right, the height of one at the bottom. + Extent float32 + // Min is the least Extent the panel may be given when room is short. Zero + // means Extent: the panel does not shrink, it either fits or is not docked. + Min float32 + // Span is the least size along the edge a panel at the bottom may be given + // when several share the band. Left and right panels take the full height + // and ignore it. + Span float32 + // Keep is the room the content must keep beside this panel when it is docked, + // across the edge: width for a panel on the left or right, height for one at + // the bottom. Zero uses the minContent Dock was given; a larger value lets one + // panel ask for more room than the others do. + Keep float32 + // Rank orders who keeps its place when room is short: a lower rank is fitted + // first, equal ranks in the order of the slice. + Rank uint8 +} + +// DockPlacement is where Dock put one panel. +type DockPlacement struct { + // Docked is false when the panel did not fit beside the content at its + // minimum. The other fields are then zero, and the caller shows the panel + // another way, or not at all. + Docked bool + // Panel is the panel's area. Divider is the strip of the gap that lies + // between the panel and what is toward the content: beside it on the left + // or right, above it at the bottom. + Panel, Divider gfx.Rect + + fitted bool +} + +// Dock divides bounds between panels docked to its left, right and bottom +// edges and the content they leave. Panels on the left and on the right take +// the full height and sit side by side from their edge inward, in the order of +// the slice: the first is outermost. Panels at the bottom share one band under +// the content column, between the left and right panels, left to right in the +// order of the slice, and each takes the band's height, which is that of the +// tallest of them. gap is the width of the divider line left between a panel +// and its neighbour toward the content. +// +// The content keeps at least minContent: a panel that would take more is first +// shrunk toward its Min, and not docked if that is not enough. Panels are +// fitted in Rank order, so the ones a user cares about most keep their place in +// a narrow window. +// +// out must hold one placement per panel; Dock fills it and allocates nothing. +// It returns the content area. A zero-size or empty bounds docks nothing. +func Dock(bounds gfx.Rect, minContent gfx.Size, gap float32, panels []DockPanel, out []DockPlacement) gfx.Rect { + if len(out) < len(panels) { + panic("components: Dock needs one placement per panel") + } + out = out[:len(panels)] + for i := range out { + out[i] = DockPlacement{} + } + gap = max(gap, 0) + + // Fit the left and right panels, then the bottom ones, in rank order. The + // sides come first because the bottom band lies between them, and so is + // only as wide as they leave. + var left, right float32 // taken from each side, dividers included + var extents [dockMaxPanels]float32 + if len(panels) > len(extents) { + panic("components: Dock supports at most 16 panels") + } + for range panels { + i := nextDockPanel(panels, out, false) + if i < 0 { + break + } + out[i].fitted = true + extent := panels[i].Extent + room := bounds.Width - left - right - max(minContent.Width, panels[i].Keep) - gap + extent = min(extent, room) + if extent < dockMinimum(panels[i]) || extent <= 0 { + continue + } + extents[i] = extent + out[i].Docked = true + if panels[i].Edge == DockLeft { + left += extent + gap + } else { + right += extent + gap + } + } + for i := range out { + out[i].fitted = false + } + + middle := bounds + middle.X += left + middle.Width = max(0, bounds.Width-left-right) + + var band float32 // height taken by the bottom band, divider included + bottom := 0 + for range panels { + i := nextDockPanel(panels, out, true) + if i < 0 { + break + } + out[i].fitted = true + room := bounds.Height - max(minContent.Height, panels[i].Keep) - gap + extent := min(panels[i].Extent, room) + if extent < dockMinimum(panels[i]) || extent <= 0 { + continue + } + // Every panel in the band needs its span, with a gap between neighbours. + need := panels[i].Span + for j := range panels { + if out[j].Docked && panels[j].Edge == DockBottom { + need += panels[j].Span + gap + } + } + if need > middle.Width { + continue + } + extents[i] = extent + out[i].Docked = true + bottom++ + band = max(band, extent+gap) + } + for i := range out { + out[i].fitted = false + } + + // The band is as tall as the tallest panel; a shorter one was fitted at its + // own extent, which only decided that it fits. + content := middle + content.Height = max(0, bounds.Height-band) + + x := bounds.X + for i, panel := range panels { + if !out[i].Docked || panel.Edge != DockLeft { + continue + } + extent := extents[i] + out[i].Panel = gfx.Rect{X: x, Y: bounds.Y, Width: extent, Height: bounds.Height} + out[i].Divider = gfx.Rect{X: x + extent, Y: bounds.Y, Width: gap, Height: bounds.Height} + x += extent + gap + } + x = bounds.Right() + for i, panel := range panels { + if !out[i].Docked || panel.Edge != DockRight { + continue + } + extent := extents[i] + out[i].Panel = gfx.Rect{X: x - extent, Y: bounds.Y, Width: extent, Height: bounds.Height} + out[i].Divider = gfx.Rect{X: x - extent - gap, Y: bounds.Y, Width: gap, Height: bounds.Height} + x -= extent + gap + } + if bottom > 0 { + height := band - gap + share := (middle.Width - float32(bottom-1)*gap) / float32(bottom) + x = middle.X + y := bounds.Bottom() - height + for i, panel := range panels { + if !out[i].Docked || panel.Edge != DockBottom { + continue + } + out[i].Panel = gfx.Rect{X: x, Y: y, Width: share, Height: height} + out[i].Divider = gfx.Rect{X: x, Y: y - gap, Width: share, Height: gap} + x += share + gap + } + } + return content +} + +// dockMaxPanels bounds the panels one Dock call lays out, so its working +// storage lives on the stack. +const dockMaxPanels = 16 + +// dockMinimum is the least extent a panel may be docked at. +func dockMinimum(panel DockPanel) float32 { + if panel.Min > 0 { + return min(panel.Min, panel.Extent) + } + return panel.Extent +} + +// nextDockPanel is the not yet fitted panel of the wanted kind, bottom or +// side, with the lowest rank, the first of equals; or -1 when none is left. +func nextDockPanel(panels []DockPanel, out []DockPlacement, bottom bool) int { + best := -1 + for i, panel := range panels { + if out[i].fitted || (panel.Edge == DockBottom) != bottom { + continue + } + if best < 0 || panel.Rank < panels[best].Rank { + best = i + } + } + return best +} + +// DockDropAt reports which edge of bounds a pointer at p is within zone of, for +// a panel dragged toward it. It is false outside bounds or when p is farther +// than zone from every docking edge; at a corner the nearer edge wins, and the +// left and right edges win a tie. +func DockDropAt(bounds gfx.Rect, p gfx.Point, zone float32) (DockEdge, bool) { + if p.X < bounds.X || p.X >= bounds.Right() || p.Y < bounds.Y || p.Y >= bounds.Bottom() { + return 0, false + } + edge, nearest := DockLeft, p.X-bounds.X + if distance := bounds.Right() - p.X; distance < nearest { + edge, nearest = DockRight, distance + } + if distance := bounds.Bottom() - p.Y; distance < nearest { + edge, nearest = DockBottom, distance + } + return edge, nearest <= zone +} + +// DockPreview is the area a panel of the given extent would take if it were +// docked to edge of bounds alone, for the outline shown while it is dragged. +func DockPreview(bounds gfx.Rect, edge DockEdge, extent float32) gfx.Rect { + switch edge { + case DockLeft: + extent = min(extent, bounds.Width) + return gfx.Rect{X: bounds.X, Y: bounds.Y, Width: extent, Height: bounds.Height} + case DockRight: + extent = min(extent, bounds.Width) + return gfx.Rect{X: bounds.Right() - extent, Y: bounds.Y, Width: extent, Height: bounds.Height} + } + extent = min(extent, bounds.Height) + return gfx.Rect{X: bounds.X, Y: bounds.Bottom() - extent, Width: bounds.Width, Height: extent} +} diff --git a/components/dock_test.go b/components/dock_test.go new file mode 100644 index 000000000..b5ce1d810 --- /dev/null +++ b/components/dock_test.go @@ -0,0 +1,199 @@ +package components + +import ( + "testing" + + "github.com/vivaui/viva/gfx" +) + +func overlaps(a, b gfx.Rect) bool { + return a.X < b.Right() && b.X < a.Right() && a.Y < b.Bottom() && b.Y < a.Bottom() +} + +// checkDock asserts the invariants of any dock result: everything lies inside +// the bounds, no two areas overlap, and a docked panel's divider touches it. +func checkDock(t *testing.T, bounds gfx.Rect, min gfx.Size, panels []DockPanel, out []DockPlacement, content gfx.Rect) { + t.Helper() + inside := func(r gfx.Rect) bool { + return r.X >= bounds.X && r.Y >= bounds.Y && r.Right() <= bounds.Right()+0.001 && r.Bottom() <= bounds.Bottom()+0.001 + } + rects := []gfx.Rect{content} + for i, p := range out { + if !p.Docked { + if p.Panel != (gfx.Rect{}) { + t.Fatalf("panel %d is not docked but has an area %+v", i, p.Panel) + } + continue + } + rects = append(rects, p.Panel, p.Divider) + if !inside(p.Panel) || !inside(p.Divider) { + t.Fatalf("panel %d leaves the bounds: %+v", i, p) + } + } + for i := range rects { + if rects[i].Width <= 0 || rects[i].Height <= 0 { + continue + } + for j := i + 1; j < len(rects); j++ { + if rects[j].Width > 0 && rects[j].Height > 0 && overlaps(rects[i], rects[j]) { + t.Fatalf("areas %+v and %+v overlap", rects[i], rects[j]) + } + } + } + if len(panels) > 0 && (content.Width < min.Width-0.001 || content.Height < min.Height-0.001) && bounds.Width >= min.Width && bounds.Height >= min.Height { + t.Fatalf("content %+v is smaller than %+v", content, min) + } +} + +func TestDockPlacesPanelsFromTheirEdgesInward(t *testing.T) { + bounds := gfx.Rect{X: 40, Y: 30, Width: 1000, Height: 600} + panels := []DockPanel{ + {Edge: DockLeft, Extent: 200}, + {Edge: DockRight, Extent: 300}, + {Edge: DockRight, Extent: 100}, + {Edge: DockBottom, Extent: 150, Span: 100}, + } + out := make([]DockPlacement, len(panels)) + content := Dock(bounds, gfx.Size{Width: 200, Height: 100}, 1, panels, out) + checkDock(t, bounds, gfx.Size{Width: 200, Height: 100}, panels, out, content) + if out[0].Panel.X != bounds.X || out[1].Panel.Right() != bounds.Right() { + t.Fatalf("outermost panels are not at their edges: %+v %+v", out[0].Panel, out[1].Panel) + } + if out[2].Panel.Right() != out[1].Divider.X { + t.Fatalf("second right panel does not abut the first's divider: %+v %+v", out[2].Panel, out[1].Divider) + } + bottom := out[3].Panel + if bottom.X != content.X || bottom.Width != content.Width || bottom.Bottom() != bounds.Bottom() || content.Bottom() != out[3].Divider.Y { + t.Fatalf("bottom band is not under the content column: band %+v content %+v", bottom, content) + } + if out[0].Panel.Height != bounds.Height { + t.Fatalf("left panel is not full height: %+v", out[0].Panel) + } +} + +func TestDockShrinksThenDropsByRank(t *testing.T) { + bounds := gfx.Rect{Width: 900, Height: 500} + min := gfx.Size{Width: 400, Height: 100} + panels := []DockPanel{ + {Edge: DockRight, Extent: 300, Min: 150, Rank: 1}, + {Edge: DockLeft, Extent: 250, Rank: 0}, + } + out := make([]DockPlacement, len(panels)) + content := Dock(bounds, min, 1, panels, out) + checkDock(t, bounds, min, panels, out, content) + if !out[1].Docked || out[1].Panel.Width != 250 { + t.Fatalf("the lower rank is fitted first at its extent: %+v", out[1]) + } + if !out[0].Docked || out[0].Panel.Width >= 300 || out[0].Panel.Width < 150 { + t.Fatalf("the other shrinks between its minimum and its extent: %+v", out[0]) + } + bounds.Width = 800 + content = Dock(bounds, min, 1, panels, out) + checkDock(t, bounds, min, panels, out, content) + if out[0].Docked || !out[1].Docked { + t.Fatalf("in a narrower window the higher rank stays: %+v %+v", out[0], out[1]) + } +} + +func TestDockKeepAsksForMoreContentThanTheMinimum(t *testing.T) { + bounds := gfx.Rect{Width: 800, Height: 500} + panels := []DockPanel{ + {Edge: DockRight, Extent: 300, Keep: 600}, + {Edge: DockLeft, Extent: 300, Rank: 1}, + } + out := make([]DockPlacement, len(panels)) + content := Dock(bounds, gfx.Size{Width: 200, Height: 100}, 1, panels, out) + checkDock(t, bounds, gfx.Size{Width: 200, Height: 100}, panels, out, content) + if out[0].Docked { + t.Fatalf("a panel that wants 600 kept does not dock in 800 with 300: %+v", out[0]) + } + if !out[1].Docked { + t.Fatalf("a panel with the ordinary minimum still docks: %+v", out[1]) + } +} + +func TestDockBottomPanelsShareTheBandAndNeedTheirSpan(t *testing.T) { + bounds := gfx.Rect{Width: 900, Height: 600} + panels := []DockPanel{ + {Edge: DockBottom, Extent: 200, Span: 300}, + {Edge: DockBottom, Extent: 120, Span: 300}, + {Edge: DockBottom, Extent: 160, Span: 300, Rank: 1}, + } + out := make([]DockPlacement, len(panels)) + content := Dock(bounds, gfx.Size{Width: 100, Height: 100}, 1, panels, out) + checkDock(t, bounds, gfx.Size{Width: 100, Height: 100}, panels, out, content) + if out[0].Panel.Height != 200 || out[1].Panel.Height != 200 { + t.Fatalf("panels in the band take the tallest height: %+v %+v", out[0].Panel, out[1].Panel) + } + if out[2].Docked { + t.Fatalf("a third panel needs 900 across with its gaps and does not fit 900 minus them: %+v", out[2]) + } + if out[0].Panel.Right() >= out[1].Panel.X { + t.Fatalf("neighbours in the band need the gap between them: %+v %+v", out[0].Panel, out[1].Panel) + } +} + +func TestDockNothingToDockLeavesAllBounds(t *testing.T) { + bounds := gfx.Rect{X: 3, Y: 4, Width: 500, Height: 300} + if got := Dock(bounds, gfx.Size{Width: 100, Height: 100}, 1, nil, nil); got != bounds { + t.Fatalf("content = %+v, want %+v", got, bounds) + } +} + +func TestDockDropNearestEdge(t *testing.T) { + bounds := gfx.Rect{X: 100, Y: 50, Width: 800, Height: 600} + for _, test := range []struct { + at gfx.Point + edge DockEdge + ok bool + }{ + {gfx.Point{X: 110, Y: 300}, DockLeft, true}, + {gfx.Point{X: 890, Y: 300}, DockRight, true}, + {gfx.Point{X: 500, Y: 640}, DockBottom, true}, + {gfx.Point{X: 500, Y: 300}, DockLeft, false}, + {gfx.Point{X: 110, Y: 645}, DockBottom, true}, // 10 from the left, 5 from the bottom + {gfx.Point{X: 50, Y: 300}, DockLeft, false}, + } { + edge, ok := DockDropAt(bounds, test.at, 40) + if ok != test.ok || (ok && edge != test.edge) { + t.Fatalf("DockDropAt(%+v) = %v, %v", test.at, edge, ok) + } + } + if edge, _ := DockDropAt(bounds, gfx.Point{X: 110, Y: 645}, 40); edge != DockBottom { + t.Fatalf("a corner takes the nearer edge, got %v", edge) + } +} + +func TestDockPreviewMatchesTheDockedPanel(t *testing.T) { + bounds := gfx.Rect{X: 10, Y: 20, Width: 800, Height: 500} + for _, edge := range []DockEdge{DockLeft, DockRight, DockBottom} { + panels := []DockPanel{{Edge: edge, Extent: 180, Span: 100}} + out := make([]DockPlacement, 1) + Dock(bounds, gfx.Size{Width: 100, Height: 100}, 0, panels, out) + if preview := DockPreview(bounds, edge, 180); preview != out[0].Panel { + t.Fatalf("edge %d: preview %+v, docked %+v", edge, preview, out[0].Panel) + } + } +} + +func TestDockAllocatesNothing(t *testing.T) { + bounds := gfx.Rect{Width: 1200, Height: 800} + panels := []DockPanel{{Edge: DockLeft, Extent: 200}, {Edge: DockRight, Extent: 300, Rank: 1}, {Edge: DockBottom, Extent: 150, Span: 200, Rank: 2}} + out := make([]DockPlacement, len(panels)) + if allocs := testing.AllocsPerRun(100, func() { Dock(bounds, gfx.Size{Width: 300, Height: 200}, 1, panels, out) }); allocs != 0 { + t.Fatalf("Dock allocates %v times", allocs) + } +} + +func BenchmarkDock(b *testing.B) { + bounds := gfx.Rect{Width: 1200, Height: 800} + panels := []DockPanel{ + {Edge: DockLeft, Extent: 240}, {Edge: DockRight, Extent: 360, Rank: 1}, {Edge: DockRight, Extent: 300, Rank: 2}, + {Edge: DockBottom, Extent: 200, Span: 240, Rank: 3}, {Edge: DockBottom, Extent: 180, Span: 240, Rank: 4}, + } + out := make([]DockPlacement, len(panels)) + b.ReportAllocs() + for b.Loop() { + Dock(bounds, gfx.Size{Width: 300, Height: 200}, 1, panels, out) + } +} diff --git a/components/field_focus_test.go b/components/field_focus_test.go index 282ec24b1..c4610e04f 100644 --- a/components/field_focus_test.go +++ b/components/field_focus_test.go @@ -51,8 +51,8 @@ func TestTextEntryFamilySharesOneFocusAndInvalidContract(t *testing.T) { len(focused.Rectangles()), len(invalid.Rectangles()), len(idle.Rectangles())) } border, fill := focused.Rectangles()[0], focused.Rectangles()[1] - if border.Color != theme.Primary { - t.Fatalf("focused border = %+v, want the accent color %+v", border.Color, theme.Primary) + if border.Color != theme.Ring { + t.Fatalf("focused border = %+v, want the ring color %+v", border.Color, theme.Ring) } if fill != idle.Rectangles()[1] { t.Fatalf("focus changed the fill: %+v, was %+v", fill, idle.Rectangles()[1]) diff --git a/components/input.go b/components/input.go index a3d19a58f..86b8f7d58 100644 --- a/components/input.go +++ b/components/input.go @@ -375,12 +375,6 @@ func inputMaskOffset(value string, offset int) int { return min(count, len(inputBullets)/3) * 3 } -const ( - // inputRing is the width of the focus ring around a button-like control - // (Vega's ring-3). Text-entry controls have none: focus is their border. - inputRing = float32(3) -) - // textEntryDark reports whether theme is a dark appearance, which Vega fills // text-entry controls for (dark:bg-input/30). func textEntryDark(theme *gfx.Theme) bool { return theme.Background.Red < 0.5 } @@ -394,8 +388,9 @@ func textEntryDark(theme *gfx.Theme) bool { return theme.Background.Red < 0.5 } // TextEntryRecipe resolves the text-entry recipe for state: // // - border-input and a transparent fill, dark:bg-input/30 (hover input/50); -// - focus: the border alone turns the accent color; there is no halo around -// the control, which would wash the field and crowd its neighbors; +// - focus: the border alone turns the ring color, as shadcn's border-ring; +// there is no halo around the control, which would wash the field and +// crowd its neighbors; // - invalid: border-destructive, which also wins over the focus color; warning is // the same with the theme's warning color, and invalid wins over it; // - disabled: opacity-50 on all of it. @@ -438,7 +433,7 @@ func textEntryTokens(theme *gfx.Theme, state gfx.State) (border, fill gfx.Color) } } if state.Focused && !state.Disabled { - border = theme.Primary + border = theme.Ring } if state.Invalid { border = theme.Danger diff --git a/components/input_group.go b/components/input_group.go index 59468bea1..e66df2d7f 100644 --- a/components/input_group.go +++ b/components/input_group.go @@ -350,7 +350,8 @@ func inputGroupPaintButton(canvas *gfx.Canvas, theme gfx.Theme, bounds gfx.Rect, if canvas.FocusVisible() == slot.ID { ring := theme.Ring ring.Alpha *= 0.50 - canvas.Rounded(expand(bounds, inputRing), radius+inputRing, ring) + focus := theme.Metrics.FocusRing() + canvas.Rounded(expand(bounds, focus), radius+focus, ring) } if canvas.Hovered() == slot.ID || canvas.Pressed() == slot.ID { canvas.Rounded(bounds, radius, theme.Accent) @@ -397,6 +398,7 @@ func inputGroupPaintControl(canvas *gfx.Canvas, theme gfx.Theme, content gfx.Rec Disabled: snapshot.Disabled, ShowCaret: snapshot.ShowCaret, Caret: snapshot.Caret, Secure: snapshot.Secure, SelectionStart: snapshot.SelectionStart, SelectionEnd: snapshot.SelectionEnd, CompositionStart: snapshot.CompositionStart, CompositionEnd: snapshot.CompositionEnd, + Blink: snapshot.Blink, }, focused) return } diff --git a/components/input_otp_test.go b/components/input_otp_test.go index 395c5b545..f7664112e 100644 --- a/components/input_otp_test.go +++ b/components/input_otp_test.go @@ -254,7 +254,7 @@ func TestInputOTPOnlyTheOuterCornersOfAGroupAreRounded(t *testing.T) { func TestInputOTPActiveSlotBorderIsCompleteOnEverySide(t *testing.T) { theme := gfx.LightTheme() - accent := theme.Primary.Over(theme.Background) + ring := theme.Ring.Over(theme.Background) for active := 0; active < 6; active++ { var canvas gfx.Canvas layout := PaintInputOTP(&canvas, theme, gfx.Rect{X: 10, Y: 12}, InputOTPSnapshot{ @@ -277,20 +277,20 @@ func TestInputOTPActiveSlotBorderIsCompleteOnEverySide(t *testing.T) { } for side, point := range probes { rectangle, ok := visibleAt(&canvas, point[0], point[1]) - if !ok || rectangle.Color != accent { - t.Errorf("active slot %d: its %s edge shows %+v, want the accent", active, side, rectangle.Color) + if !ok || rectangle.Color != ring { + t.Errorf("active slot %d: its %s edge shows %+v, want the ring color", active, side, rectangle.Color) } } // The ring must not leak onto the neighbors' outer edges. if active > 0 && active%3 != 0 { rectangle, _ := visibleAt(&canvas, layout.SlotBounds(active-1).X+0.5, y) - if rectangle.Color == accent { + if rectangle.Color == ring { t.Errorf("active slot %d recolored the far edge of its left neighbor", active) } } if active < 5 && (active+1)%3 != 0 { rectangle, _ := visibleAt(&canvas, layout.SlotBounds(active+1).X+layout.SlotSize-0.5, y) - if rectangle.Color == accent { + if rectangle.Color == ring { t.Errorf("active slot %d recolored the far edge of its right neighbor", active) } } diff --git a/components/input_test.go b/components/input_test.go index 5c3a01041..be5e73579 100644 --- a/components/input_test.go +++ b/components/input_test.go @@ -60,8 +60,8 @@ func TestInputFocusFromThePointerAndTheKeyboardTurnsTheBorder(t *testing.T) { if len(focused.Rectangles()) != len(idle.Rectangles()) { t.Fatalf("focus painted %d rectangles, want the %d of a resting field", len(focused.Rectangles()), len(idle.Rectangles())) } - if focused.Rectangles()[0].Color != theme.Primary { - t.Fatalf("focused border = %+v, want the accent color %+v", focused.Rectangles()[0].Color, theme.Primary) + if focused.Rectangles()[0].Color != theme.Ring { + t.Fatalf("focused border = %+v, want the ring color %+v", focused.Rectangles()[0].Color, theme.Ring) } }) } diff --git a/components/item.go b/components/item.go index a1d0f3e08..035df2155 100644 --- a/components/item.go +++ b/components/item.go @@ -153,7 +153,8 @@ func (item Item) Paint(title, description, trailing string) ItemLayout { if focused { focus := item.theme.Ring focus.Alpha *= 0.50 - item.canvas.RoundedBorder(expand(item.bounds, 3), gfx.RadiusOutset(metrics.RadiusControl, 3), 3, focus, gfx.Color{}) + ring := metrics.FocusRing() + item.canvas.RoundedBorder(expand(item.bounds, ring), gfx.RadiusOutset(metrics.RadiusControl, ring), ring, focus, gfx.Color{}) } background := gfx.Color{} diff --git a/components/markdown.go b/components/markdown.go index 6146529d0..dfd67c909 100644 --- a/components/markdown.go +++ b/components/markdown.go @@ -19,6 +19,9 @@ type MarkdownStyle struct { Size float32 // LineHeight is the distance between the lines of body text. LineHeight float32 + // HeadingAlign aligns every visual line of a heading, wrapped ones included. + // The zero value is markdown.AlignLeft. + HeadingAlign markdown.Align // MonoFace is the fixed-pitch family of code. MonoFace gfx.MonoFace // CodeInset keeps this much of the right side of every code block free of @@ -490,7 +493,7 @@ func (v *MarkdownView) Layout(canvas *gfx.Canvas, style MarkdownStyle, doc *mark case markdown.Heading: blkSpan.rowLo = int32(len(v.rowSpans)) l.appendSpans(doc.Spans(b)) - y = l.inline(doc.Spans(b), x0, w, y, l.heading(b.Level, t), markdown.AlignLeft) + y = l.inline(doc.Spans(b), x0, w, y, l.heading(b.Level, t), style.HeadingAlign) blkSpan.rowHi = int32(len(v.rowSpans)) case markdown.Item: indent := float32(b.Level)*markdownListStep + markdownMarkerW diff --git a/components/markdown_heading_align_test.go b/components/markdown_heading_align_test.go new file mode 100644 index 000000000..3bacf70bb --- /dev/null +++ b/components/markdown_heading_align_test.go @@ -0,0 +1,28 @@ +package components + +import ( + "math" + "testing" + + "github.com/vivaui/viva/markdown" +) + +func TestMarkdownHeadingAlignmentCentersEachWrappedLine(t *testing.T) { + view, _ := layoutMarkdown(t, "# Alpha Beta Gamma Delta", 100, MarkdownStyle{Size: 12, LineHeight: 20, HeadingAlign: markdown.AlignCenter}) + if len(view.rowSpans) < 2 { + t.Fatal("heading did not wrap") + } + for _, row := range view.rowSpans { + if row.pieceLo >= row.pieceHi { + continue + } + left, right := float32(math.MaxFloat32), float32(0) + for _, piece := range view.pieces[row.pieceLo:row.pieceHi] { + left = min(left, piece.x) + right = max(right, piece.x+piece.w) + } + if math.Abs(float64(left+right-100)) > 1 { + t.Errorf("wrapped row not centered: left=%v right=%v", left, right) + } + } +} diff --git a/components/message_scroller.go b/components/message_scroller.go index 3fa75418f..eb6254105 100644 --- a/components/message_scroller.go +++ b/components/message_scroller.go @@ -240,7 +240,8 @@ func (scroller MessageScroller) paintButton(bounds gfx.Rect, id gfx.ID, label st if scroller.canvas.FocusVisible() == id { ring := scroller.theme.Ring ring.Alpha *= 0.50 - scroller.canvas.Rounded(messageScrollerExpand(bounds, 3), gfx.RadiusOutset(scroller.theme.Metrics.RadiusControl, 3), ring) + focus := scroller.theme.Metrics.FocusRing() + scroller.canvas.Rounded(messageScrollerExpand(bounds, focus), gfx.RadiusOutset(scroller.theme.Metrics.RadiusControl, focus), ring) } scroller.canvas.RoundedBorder(bounds, scroller.theme.Metrics.RadiusControl, 1, scroller.theme.Border, background) icon := &arrowDownIcon diff --git a/components/overlay_initial_focus_test.go b/components/overlay_initial_focus_test.go index 99adf5e40..d53e61fe2 100644 --- a/components/overlay_initial_focus_test.go +++ b/components/overlay_initial_focus_test.go @@ -29,7 +29,7 @@ func TestSheetDrawerAndAlertDialogSetInitialFocus(t *testing.T) { BeginAlertDialog(&alertCanvas, gfx.LightTheme(), gfx.Rect{Width: 800, Height: 600}, AlertDialogOptions{ Scope: gfx.Item(7), ActionID: gfx.Item(8), CancelID: gfx.Item(9), InitialFocusID: gfx.Item(8), }).Paint("Title", "Description", "Delete", "Cancel") - if alertCanvas.InitialFocus() != gfx.Item(8) { - t.Fatalf("alert initial focus = %v", alertCanvas.InitialFocus()) + if alertCanvas.InitialFocus() != gfx.Item(8) || !alertCanvas.InitialFocusVisible() { + t.Fatalf("alert initial focus = %v, visible %v", alertCanvas.InitialFocus(), alertCanvas.InitialFocusVisible()) } } diff --git a/components/questionnaire.go b/components/questionnaire.go index 22030d5b3..260bd53d3 100644 --- a/components/questionnaire.go +++ b/components/questionnaire.go @@ -193,7 +193,8 @@ func (questionnaire *Questionnaire) AddChoice(choice QuestionnaireChoice) { if focused { ring := theme.Ring ring.Alpha *= 0.50 - canvas.Rounded(expand(bounds, 3), radius+3, ring) + focus := metrics.FocusRing() + canvas.Rounded(expand(bounds, focus), radius+focus, ring) } canvas.RoundedBorder(bounds, radius, 1, border.Over(theme.Background), fill.Over(theme.Background)) diff --git a/components/radio_group.go b/components/radio_group.go index a803d0f83..6a5458a41 100644 --- a/components/radio_group.go +++ b/components/radio_group.go @@ -213,16 +213,17 @@ func (group RadioGroup) Paint() RadioGroupResult { border = group.theme.Primary fill = group.theme.Primary } + focus := group.theme.Metrics.FocusRing() switch { case option.Invalid && enabled: // The ring is for a control the user can act on; a selected invalid // option keeps its primary border and still shows it. - group.canvas.Rounded(expand(circle, 3), diameter/2+3, invalidRing(&group.theme)) + group.canvas.Rounded(expand(circle, focus), diameter/2+focus, invalidRing(&group.theme)) if !selected { border = invalidBorder(&group.theme) } case focused: - group.canvas.Rounded(expand(circle, 3), diameter/2+3, scaledAlpha(group.theme.Ring, 0.50)) + group.canvas.Rounded(expand(circle, focus), diameter/2+focus, scaledAlpha(group.theme.Ring, 0.50)) if !selected { border = group.theme.Ring } diff --git a/components/segmented_control.go b/components/segmented_control.go index edf1923ab..2816ae498 100644 --- a/components/segmented_control.go +++ b/components/segmented_control.go @@ -166,11 +166,11 @@ func (control SegmentedControl) Paint() SegmentedControlResult { fill := palette.fill(&control.theme, state) if segmentFocused(state) { // The segment that holds the keyboard, not the whole control. - ring := scaledAlpha(control.theme.Ring, 0.50) + ring, focus := scaledAlpha(control.theme.Ring, 0.50), control.theme.Metrics.FocusRing() if control.theme.Background.Alpha < 1 { - control.canvas.RoundedOutline(segmentedControlExpand(surface, 3), innerRadius+3, 2, ring) + control.canvas.RoundedOutline(segmentedControlExpand(surface, focus), innerRadius+focus, 2, ring) } else { - control.canvas.Rounded(segmentedControlExpand(surface, 3), innerRadius+3, ring) + control.canvas.Rounded(segmentedControlExpand(surface, focus), innerRadius+focus, ring) } paintBordered(control.canvas, control.theme, surface, innerRadius, control.theme.Ring, fill) continue @@ -279,7 +279,7 @@ func SegmentRecipe(theme gfx.Theme, state gfx.State, groupDisabled bool) Segment palette := newSegmentPalette(&theme, groupDisabled) look := SegmentLook{Fill: palette.fill(&theme, state), Foreground: palette.foreground(&theme, state)} if segmentFocused(state) { - look.Border, look.Ring, look.RingWidth = theme.Ring, scaledAlpha(theme.Ring, 0.50), 3 + look.Border, look.Ring, look.RingWidth = theme.Ring, scaledAlpha(theme.Ring, 0.50), theme.Metrics.FocusRing() look.RingOutline = theme.Background.Alpha < 1 } return look diff --git a/components/split_button.go b/components/split_button.go index 53a10718e..409dc42b2 100644 --- a/components/split_button.go +++ b/components/split_button.go @@ -151,7 +151,8 @@ func (button SplitButton) paintFocus(bounds gfx.Rect, variant ButtonVariant, id return } ring, _ := buttonRing(&button.theme, variant, false) - button.canvas.Rounded(expand(bounds, 3), gfx.RadiusOutset(button.theme.Metrics.RadiusControl, 3), ring) + focus := button.theme.Metrics.FocusRing() + button.canvas.Rounded(expand(bounds, focus), gfx.RadiusOutset(button.theme.Metrics.RadiusControl, focus), ring) } func (button SplitButton) paintHalf(bounds gfx.Rect, index int, variant ButtonVariant, id gfx.ID, framed bool, radius float32) { diff --git a/components/switch.go b/components/switch.go index 907f884bb..3804c2127 100644 --- a/components/switch.go +++ b/components/switch.go @@ -248,7 +248,7 @@ func switchRecipe(theme *gfx.Theme, state gfx.State, progress float32) SwitchLoo if state.Invalid { look.Ring, look.Border = invalidRing(theme), invalidBorder(theme) } - look.RingWidth = 3 + look.RingWidth = theme.Metrics.FocusRing() } if state.Disabled { look.Track.Alpha *= 0.50 diff --git a/components/switch_test.go b/components/switch_test.go index 97089fcf0..6df721413 100644 --- a/components/switch_test.go +++ b/components/switch_test.go @@ -85,7 +85,7 @@ func TestSwitchFocusUsesOfficialRingAndPreviewHasNoHit(t *testing.T) { BeginSwitch(&preview, theme, gfx.ID{}, gfx.Rect{}, false).Paint() want := theme.Ring want.Alpha *= 0.50 - if ring := focused.Rectangles()[0]; ring.Color != want || ring.Bounds != (gfx.Rect{X: 1, Y: 1, Width: 38, Height: 24.4}) { + if ring := focused.Rectangles()[0]; ring.Color != want || ring.Bounds != expand(gfx.Rect{X: 4, Y: 4, Width: 32, Height: 18.4}, theme.Metrics.FocusRing()) { t.Fatalf("focus ring = %+v", ring) } if len(preview.Hits()) != 0 { diff --git a/components/tabs.go b/components/tabs.go index c1c821564..88bd5145a 100644 --- a/components/tabs.go +++ b/components/tabs.go @@ -514,7 +514,8 @@ func tabTriggerRecipe(theme *gfx.Theme, variant TabsVariant, state gfx.State) Ta if !state.Disabled && state.FocusVisible { look.Ring = theme.Ring look.Ring.Alpha *= 0.50 - look.RingWidth, look.RingRadius = 3, radius+3 + focus := theme.Metrics.FocusRing() + look.RingWidth, look.RingRadius = focus, radius+focus } if state.Selected && variant == TabsDefault { fill := theme.Background diff --git a/components/textarea.go b/components/textarea.go index 75c14d209..079fe9027 100644 --- a/components/textarea.go +++ b/components/textarea.go @@ -186,6 +186,12 @@ func textareaPaintRows(canvas *gfx.Canvas, theme gfx.Theme, bounds gfx.Rect, val width = 0 } + // A caret the component paints keeps its own blink phase. + showCaret := focused && snapshot.ShowCaret && !snapshot.Disabled + if showCaret && snapshot.Blink != nil { + showCaret = snapshot.Blink.Lit(canvas, snapshot.Caret) + } + // The layout follows the text of the box, not its hint. layout := snapshot.Layout rows := textareaRows{canvas: canvas, text: value, size: fontSize, width: width} @@ -294,12 +300,12 @@ func textareaPaintRows(canvas *gfx.Canvas, theme gfx.Theme, bounds gfx.Rect, val if holdsCaret { caretOffset := textareaBoundary(line, min(caret-row.Start, len(line))) x := min(origin+canvas.TextCaret(line, fontSize, gfx.WeightRegular, caretOffset), labelBounds.X+labelBounds.Width-1) - textareaPlaceCaret(canvas, theme, layout, lineBounds, x, focused && snapshot.ShowCaret && !snapshot.Disabled) + textareaPlaceCaret(canvas, theme, layout, lineBounds, x, showCaret) } } if placeholderShown && index == 0 { // An empty box has its caret at the start, in front of the hint. - textareaPlaceCaret(canvas, theme, layout, lineBounds, origin, focused && snapshot.ShowCaret && !snapshot.Disabled) + textareaPlaceCaret(canvas, theme, layout, lineBounds, origin, showCaret) } paintTextareaLine(canvas, snapshot, line, labelBounds, style) for _, selection := range selections { diff --git a/components/toast.go b/components/toast.go index ccd3dd5c8..4be86cfbf 100644 --- a/components/toast.go +++ b/components/toast.go @@ -61,7 +61,7 @@ const ( toastTextGap = float32(2) toastPeek = float32(10) toastStackGap = float32(10) - toastIconSize = float32(20) + toastIconSize = float32(16) toastCloseSize = float32(20) // A string's measured width and the sum of its clusters can differ by a // fraction; the slack keeps a line that was measured to fit from wrapping. @@ -217,16 +217,22 @@ func PaintToast(canvas *gfx.Canvas, theme gfx.Theme, viewport gfx.Rect, snapshot canvas.Shadow(bounds, metrics.RadiusSurface, gfx.ShadowStyle{OffsetY: 2, Blur: 4}, gfx.Color{Alpha: 0.06}) canvas.Rounded(bounds, metrics.RadiusSurface, theme.Popover) - // The icon, the text, the action and the close button are centered on the row - // the padding leaves. + // The text and the action are centered on the row the padding leaves. The icon + // and the close button belong to the title: they center on its line, which is + // the whole row until a description puts a second line under it. row := gfx.Rect{X: bounds.X + toastPaddingX, Y: bounds.Y + toastPaddingY, Width: bounds.Width - 2*toastPaddingX, Height: bounds.Height - 2*toastPaddingY} textX := row.X + titleHeight, descriptionHeight := overlayLineHeight(metrics), toastDescriptionLineHeight(metrics) + titleTop := row.Y + (row.Height-geometry.text)/2 + if geometry.text <= titleHeight { + titleTop = row.Y + (row.Height-titleHeight)/2 + } if geometry.hasIcon { - layout.Icon = gfx.Rect{X: row.X, Y: row.Y + (row.Height-toastIconSize)/2, Width: toastIconSize, Height: toastIconSize} + layout.Icon = gfx.Rect{X: row.X, Y: titleTop + (titleHeight-toastIconSize)/2, Width: toastIconSize, Height: toastIconSize} paintToastIcon(canvas, theme, layout.Icon, snapshot.Type) textX += toastIconSize + toastItemGap } - layout.Close = gfx.Rect{X: row.X + row.Width - toastCloseSize, Y: row.Y + (row.Height-toastCloseSize)/2, Width: toastCloseSize, Height: toastCloseSize} + layout.Close = gfx.Rect{X: row.X + row.Width - toastCloseSize, Y: titleTop + (titleHeight-toastCloseSize)/2, Width: toastCloseSize, Height: toastCloseSize} right := layout.Close.X - toastItemGap if geometry.actionWidth > 0 { button := BeginButton(canvas, theme, options.ActionID, gfx.Rect{X: right - geometry.actionWidth, Y: row.Y, Width: geometry.actionWidth}).Small() @@ -254,7 +260,6 @@ func PaintToast(canvas *gfx.Canvas, theme gfx.Theme, viewport gfx.Rect, snapshot } layout.Body = gfx.Rect{X: textX, Y: row.Y + (row.Height-geometry.text)/2, Width: max(0, right-textX), Height: geometry.text} - titleHeight, descriptionHeight := overlayLineHeight(metrics), toastDescriptionLineHeight(metrics) canvas.Label(snapshot.Title, gfx.Rect{X: layout.Body.X, Y: layout.Body.Y, Width: layout.Body.Width, Height: titleHeight}, gfx.TextStyle{Size: metrics.FontSizeM, Weight: gfx.WeightMedium, Color: theme.PopoverForeground}) overlayParagraph(canvas, lines, gfx.Rect{X: layout.Body.X, Y: layout.Body.Y + titleHeight + toastTextGap, Width: layout.Body.Width}, descriptionHeight, gfx.TextStyle{ Size: metrics.FontSizeS, Weight: gfx.WeightRegular, Color: theme.MutedForeground, @@ -324,7 +329,7 @@ func toastPresence(theme gfx.Theme, position ToastPosition) gfx.Presence { const toastSpinnerStep = 100 * time.Millisecond // paintToastIcon draws the icon of a toast type in the 16px box, as Base UI's -// ToastIcon does: Lucide's circle-check, info, triangle-alert and octagon-x, in +// ToastIcon does: Lucide's circle-check, info, triangle-alert and circle-x, in // the text color (the error's in the destructive one), and a spinner for a // loading toast, which turns with the frame clock and asks for the next step. func paintToastIcon(canvas *gfx.Canvas, theme gfx.Theme, bounds gfx.Rect, kind ToastType) { @@ -343,7 +348,7 @@ func paintToastIcon(canvas *gfx.Canvas, theme gfx.Theme, bounds gfx.Rect, kind T case ToastWarning: canvas.DrawIcon(triangleAlertIcon, bounds, theme.PopoverForeground) case ToastError: - canvas.DrawIcon(octagonXIcon, bounds, theme.Danger) + canvas.DrawIcon(circleXIcon, bounds, theme.Danger) } } @@ -365,9 +370,11 @@ var ( gfx.ClosePath(), gfx.MoveTo(12, 16), gfx.LineTo(12, 12), gfx.MoveTo(12, 8), gfx.LineTo(12.01, 8), }} - octagonXIcon = gfx.Icon{ViewBox: 24, Stroke: 2, Cap: gfx.CapRound, Join: gfx.JoinRound, Commands: []gfx.PathCommand{ - gfx.MoveTo(7.86, 2), gfx.LineTo(16.14, 2), gfx.LineTo(22, 7.86), gfx.LineTo(22, 16.14), gfx.LineTo(16.14, 22), - gfx.LineTo(7.86, 22), gfx.LineTo(2, 16.14), gfx.LineTo(2, 7.86), gfx.ClosePath(), + circleXIcon = gfx.Icon{ViewBox: 24, Stroke: 2, Cap: gfx.CapRound, Join: gfx.JoinRound, Commands: []gfx.PathCommand{ + gfx.MoveTo(22, 12), + gfx.CubicTo(22, 17.523, 17.523, 22, 12, 22), gfx.CubicTo(6.477, 22, 2, 17.523, 2, 12), + gfx.CubicTo(2, 6.477, 6.477, 2, 12, 2), gfx.CubicTo(17.523, 2, 22, 6.477, 22, 12), + gfx.ClosePath(), gfx.MoveTo(15, 9), gfx.LineTo(9, 15), gfx.MoveTo(9, 9), gfx.LineTo(15, 15), }} triangleAlertIcon = gfx.Icon{ViewBox: 24, Stroke: 2, Cap: gfx.CapRound, Join: gfx.JoinRound, Commands: []gfx.PathCommand{ diff --git a/components/toast_test.go b/components/toast_test.go index 4a0a72e05..a3df308b3 100644 --- a/components/toast_test.go +++ b/components/toast_test.go @@ -84,6 +84,25 @@ func TestToastDescriptionWrapsAndTheToastGrows(t *testing.T) { } } +func TestToastIconAndCloseStayOnTheTitleLineWhenThereIsADescription(t *testing.T) { + var canvas gfx.Canvas + viewport := gfx.Rect{Width: 1000, Height: 700} + options := ToastOptions{Layer: 3, DismissID: gfx.Item(1)} + paint := func(description string) ToastLayout { + return PaintToast(&canvas, gfx.LightTheme(), viewport, ToastSnapshot{Title: "Upload failed", Description: description, Type: ToastError}, options) + } + plain, described := paint(""), paint("The server closed the connection before the whole file had been written.") + titleBottom := described.Body.Y + overlayLineHeight(gfx.LightTheme().Metrics) + for name, rect := range map[string]gfx.Rect{"icon": described.Icon, "close": described.Close} { + if rect.Y < described.Body.Y || rect.Y+rect.Height > titleBottom { + t.Errorf("%s %+v is not inside the title line %v..%v", name, rect, described.Body.Y, titleBottom) + } + } + if center := plain.Icon.Y + plain.Icon.Height/2; center != plain.Bounds.Y+plain.Bounds.Height/2 { + t.Errorf("a title-only toast's icon center %v is off the toast's center", center) + } +} + func TestToastPositionPicksTheCornerAndLoadingAsksForFramesOnlyWhileShown(t *testing.T) { viewport := gfx.Rect{Width: 1000, Height: 700} var canvas gfx.Canvas diff --git a/components/toggle.go b/components/toggle.go index 1691e4820..386ee0fac 100644 --- a/components/toggle.go +++ b/components/toggle.go @@ -57,7 +57,8 @@ func ToggleRecipe(theme gfx.Theme, variant ToggleVariant, state gfx.State) style if state.Invalid { ring, edge = invalidRing(&theme), invalidBorder(&theme) } - look.Ring, look.RingWidth, look.RingRadius = ring, 3, radius+3 + focus := theme.Metrics.FocusRing() + look.Ring, look.RingWidth, look.RingRadius = ring, focus, radius+focus look.Border, look.Bordered = edge, true } if state.Disabled { diff --git a/components/toggle_group.go b/components/toggle_group.go index d8457bb16..edbf122be 100644 --- a/components/toggle_group.go +++ b/components/toggle_group.go @@ -291,7 +291,8 @@ func (group ToggleGroup) Paint() ToggleGroupResult { pressed := enabled && group.canvas.Pressed() == option.ID focused := enabled && group.canvas.FocusVisible() == option.ID if focused { - group.canvas.Rounded(expand(bounds, 3), radius+3, scaledAlpha(group.theme.Ring, 0.50)) + focus := group.theme.Metrics.FocusRing() + group.canvas.Rounded(expand(bounds, focus), radius+focus, scaledAlpha(group.theme.Ring, 0.50)) } fill := group.theme.Background fill.Alpha = 0 diff --git a/components/tooltip.go b/components/tooltip.go index 86f3e72af..4a8689ee6 100644 --- a/components/tooltip.go +++ b/components/tooltip.go @@ -369,6 +369,13 @@ func (hover *HoverTooltip) ShowOnFocus() { hover.focus = true } // for hits without a Hint. func (hover *HoverTooltip) Paint(canvas *gfx.Canvas, theme gfx.Theme, viewport gfx.Rect, options TooltipOptions, delay time.Duration) bool { hovered := canvas.Hovered() + // A disabled control is never hovered, but its Hint still describes it, as the + // system's own controls show a tooltip while disabled. + if disabled := canvas.HoveredDisabled(); !disabled.IsZero() { + if _, ok := hoverHintHit(canvas.Hits(), disabled); ok { + hovered = disabled + } + } hover.holdByFinger(canvas) if !canvas.Pressed().IsZero() && hover.held.IsZero() { if !hover.shown.IsZero() { diff --git a/components/tooltip_hover_test.go b/components/tooltip_hover_test.go index ccc9064bc..f80d0af68 100644 --- a/components/tooltip_hover_test.go +++ b/components/tooltip_hover_test.go @@ -177,3 +177,29 @@ func TestHoverTooltipDismissesOnEscapeAndPress(t *testing.T) { t.Fatal("a press outside the control left the tooltip up") } } + +// A disabled control is never the hovered hit, yet its hint still opens: the +// runtime reports it through HoveredDisabled, and only the hint's owner is told. +func TestHoverTooltipDescribesADisabledControl(t *testing.T) { + var hover HoverTooltip + viewport := gfx.Rect{Width: 300, Height: 200} + frame := func(now time.Duration, hint string) (*gfx.Canvas, bool) { + var canvas gfx.Canvas + canvas.SetClock(func() time.Duration { return now }) + canvas.BeginFrame() + canvas.HitWithOptions(gfx.Item(7), gfx.Rect{X: 40, Y: 10, Width: 28, Height: 28}, "Export", gfx.HitOptions{Hint: hint, Disabled: true}) + canvas.SetInteraction(gfx.ID{}, gfx.ID{}, gfx.ID{}, false) + canvas.SetHoveredDisabled(gfx.Item(7)) + painted := hover.Paint(&canvas, gfx.DarkTheme(), viewport, TooltipOptions{}, testTooltipDelay) + canvas.EndFrame() + return &canvas, painted + } + frame(0, "Export recording") + canvas, painted := frame(testTooltipDelay, "Export recording") + if _, ok := tooltipText(canvas, "Export recording"); !painted || !ok { + t.Fatalf("no tooltip over a disabled control: painted %v shown %v", painted, ok) + } + if _, painted := frame(2*testTooltipDelay, ""); painted { + t.Fatal("a disabled control without a hint opened a tooltip") + } +} diff --git a/docs/conformance.md b/docs/conformance.md index a8a7d435e..6d2d7f941 100644 --- a/docs/conformance.md +++ b/docs/conformance.md @@ -293,6 +293,9 @@ idempotence, normal-placement restoration, full monitor bounds, caption-button removal, inert move regions, reentrant requests, and concurrent window state reads. Those tests do not establish native window-manager behavior. +`Window.SetFullscreenAllMonitors` and `Window.Monitors` are covered the same way by +simulated displays; no real multi-monitor span is established by those tests. + Native acceptance still requires these runs on real desktops: - Windows: enter from normal and maximized placement, cover the monitor rather diff --git a/docs/releases/0.6.11.md b/docs/releases/0.6.11.md new file mode 100644 index 000000000..09092a27b --- /dev/null +++ b/docs/releases/0.6.11.md @@ -0,0 +1,45 @@ +v0.6.11 是 v0.6.10 之后的版本:键盘焦点环统一画成 2px;新增敏感剪贴板写入、状态项主次点击分流、多显示器全屏、窗口回显回调与 Windows 提权重启;文本选择支持多击与 Shift 扩选,并修复输入法、菜单、滚动、提示与托盘图标方面的问题。macOS 是参考平台。 + +v0.6.11 comes after v0.6.10: keyboard focus rings are drawn 2px wide from one metric; sensitive clipboard writes, primary and secondary status item clicks, fullscreen across monitors, a hidden window's return callback and an elevated restart on Windows arrive; text selection gains multi-click and Shift extension; and input method, menu, scrolling, tooltip and tray icon issues are fixed. macOS is the reference platform. + +## 拿到它 · Getting it + +`go get github.com/vivaui/viva@v0.6.11`,需要 Go 1.26 或更新;系统依赖与 v0.6.10 相同。每个 Release 附带 `viva` 命令的预编译压缩包、`SHA256SUMS`,以及 Homebrew 与 Scoop 清单(`brew install vivaui/tap/viva`,或 `scoop bucket add vivaui https://github.com/vivaui/homebrew-tap` 后 `scoop install viva`)。 + +`go get github.com/vivaui/viva@v0.6.11` needs Go 1.26 or newer; the system requirements are those of v0.6.10. Every Release carries prebuilt archives of the `viva` command, `SHA256SUMS`, and Homebrew and Scoop manifests (`brew install vivaui/tap/viva`, or `scoop bucket add vivaui https://github.com/vivaui/homebrew-tap` then `scoop install viva`). + +## 有什么 · What is in it + +- 键盘焦点环统一为 2px,宽度出自同一个度量;工具提示在控件被禁用时仍会显示;滚动条可按住轨道连续翻页。 +- 剪贴板可以写入敏感内容,并在保护下定时清除;Linux 写入 `gnome-copied-files` 时只用 LF 换行。 +- 状态项的主点击交给 `OnClick`,次点击弹出菜单;`Config.OnShow` 报告被隐藏的窗口重新出现;窗口可以跨所有显示器全屏,应用可列出显示器;Windows 上可以以提权方式启动程序副本。 +- `TextSelection` 支持多击与 Shift+点击选择,Shift+按下可按词或按行扩选;按字节偏移查找词或行范围更快。 +- `Scroll` 中的 Sticky 元素停靠顶部;进入列表的行不再盖在下方行上;列表末尾跟随时 `ScrollTo` 可以离开末尾;区域按页滚动时保留重叠行。 +- 文本框可以在接收粘贴前检查内容;`TextArea` 的 `ShowCount` 计数显示在文本下方;自绘输入会滚动以保持插入符可见;`InputNumber` 在设置 `Step` 时推算小数位数。 +- 新增 CodeMerge 冲突的跟踪、计数与导航,颜色选择器的即时编辑,`TreeItem` 的整行背景,基于共享纹理的视频播放与 GIF/APNG 解码;`MarkdownView` 的绘制与命中测试改为索引查找。 +- 新增应用审计工具,可发现空闲唤醒与窗口线程上的 I/O;Windows 的诊断报告图形路径。 +- 修复 macOS 输入法清空标记文本时未结束组合的问题,并为 Metal 图层标注 sRGB 色彩空间。 +- 修复 Windows 上首次菜单助记键丢失、32bpp 状态图标蒙版、禁用连字时每格一个字形、自定义 web scheme 的路径与来源、OpenWith 编辑器窗口不显示,以及水印盖在所有者弹窗之上;Linux 按 Num Lock 与 Shift 处理小键盘,隔离等宽字体扫描与 Cairo 渲染。 +- 修复菜单行在无图标时缺少图标空位、弹出菜单滚动条无法拖动、颜色选择器面板被滚动裁剪、下拉菜单安装配方不同步,以及 Toast 的图标与关闭按钮对齐。 + +- Keyboard focus rings are 2px wide, drawn from one metric; a control's tooltip shows while it is disabled; and a scrollbar pages continuously while its track is held. +- The clipboard accepts a sensitive write that is cleared on a guarded timer; Linux writes `gnome-copied-files` with LF-only lines. +- A status item's primary click goes to `OnClick` and its secondary click opens the menu; `Config.OnShow` reports a hidden window coming back; a window can go fullscreen across all monitors and the application can list them; and on Windows the program can start an elevated copy of itself. +- `TextSelection` adds multi-click and Shift+click selection, Shift+press extends by words or lines, and finding a word or line span by byte offset is faster. +- Sticky elements hold at the top of a `Scroll`; a list row that comes in no longer paints over the rows below; `ScrollTo` can leave the end of a following `List`; and a region that scrolls by a page keeps an overlap. +- Text fields can inspect a paste before taking it; a `TextArea`'s `ShowCount` shows its count under the text; a self-painted input scrolls to keep its caret in view; and `InputNumber` works out step decimals when `Step` is set. +- New are CodeMerge conflict tracking, counting and navigation, live editing in the color picker, a full-width row background on `TreeItem`, and shared-texture video playback with GIF/APNG decoders; `MarkdownView` paint and hit testing are indexed. +- A new audit tool finds idle wakes and window-thread I/O in an application, and Windows diagnostics report the graphics path. +- macOS ends the composition when the input method empties its mark, and the Metal layer is tagged with the sRGB color space. +- Windows delivers the first menu mnemonic keypress, builds the AND mask for 32bpp status icons, keeps one glyph per cell when a run asks for no ligatures, preserves the path and origin of custom web schemes, shows the editor window `OpenWith` starts, and raises the watermark above the owner's popups; Linux respects Num Lock and Shift for keypad input and isolates monospace font scanning from Cairo rendering. +- Menu rows without an icon keep the icon room, popup menu scrollbars can be dragged, color picker panels escape scroll clipping, the dropdown menu installer recipe is in sync, and a toast's icon and close button align with its title. + +## 注意 · Caveats + +- `components.CarouselStepForKey` 按阅读方向翻转左右键,签名变为 `(key, index, count, orientation, direction)`,调用点需要补上 `direction`。 +- 没有其他不兼容的 API 变更。 +- 本版没有在 Linux 与 Windows 真机上整体验收;水印叠加层的 z 序与提权重启尚未在真机上验证。 + +- `components.CarouselStepForKey` now follows the reading direction and its signature is `(key, index, count, orientation, direction)`; callers must pass `direction`. +- There are no other incompatible API changes. +- This release was not accepted as a whole on real Linux and Windows desktops; the watermark overlay's z-order and the elevated restart are not yet verified on real devices. diff --git a/docs/system-integrations.md b/docs/system-integrations.md index 9c093e47a..2eff9a43f 100644 --- a/docs/system-integrations.md +++ b/docs/system-integrations.md @@ -10,6 +10,7 @@ synchronous forms report `ErrAsyncRequired`, `ErrSecretStoreUnavailable` or | Capability | macOS | Windows | Linux/X11 | WebAssembly browser | | --- | --- | --- | --- | --- | | Read/write text clipboard | `NSPasteboard` | Unicode Win32 clipboard | X11 `CLIPBOARD`, `UTF8_STRING` with `STRING` read fallback; text above 128 KiB is served and read in pieces (INCR); handed to the clipboard manager when the owning window closes, if the desktop has one | synchronous calls return `ErrAsyncRequired`; `ClipboardTextAsync` and `SetClipboardTextAsync` use the Clipboard API and require a user gesture | +| Sensitive text clipboard (`SetSensitiveClipboardText`, `CapabilityClipboardSensitive`) | `NSPasteboard` prepared with `NSPasteboardContentsCurrentHostOnly` (excluded from Universal Clipboard), `org.nspasteboard.ConcealedType` and `org.nspasteboard.TransientType` beside `public.utf8-plain-text`; returned `clear` checks `changeCount` before clearing | `CF_UNICODETEXT` beside `ExcludeClipboardContentFromMonitorProcessing`, `CanIncludeInClipboardHistory` (`DWORD` `0`) and `CanUploadToCloudClipboard` (`DWORD` `0`) in one clipboard transaction; returned `clear` checks `GetClipboardSequenceNumber` inside `OpenClipboard` | X11 `CLIPBOARD`: `x-kde-passwordManagerHint` (`"secret"`) beside `UTF8_STRING`, never handed to `CLIPBOARD_MANAGER` on window close, and `clear` releases the selection only if ownership and write generation still match; the GTK shell serves the same hint through `gtk_clipboard_set_with_data` | `ErrUnsupported`: browsers offer neither concealment markers nor a clipboard change counter | | Column-selection clipboard (`SetRectangularClipboardText`, `ClipboardTextWithFormat`; `TextInput.CopyRectangular`, `TextEvent.Rectangular`) | no platform format; reads report `false` | Unicode text beside `MSDEVColumnSelect` (presence) and `Borland IDE Block Type` (one byte, `0x02`); an advertised marker whose data cannot be read is pasted as stream text | reads report `false` | reads report `false` | | Rich copy (`SetClipboardHTML`, html + plain alt) | `NSPasteboard`: `public.html` beside `public.utf8-plain-text` | registered `HTML Format` (CF_HTML, with its header of byte offsets) beside `CF_UNICODETEXT` | X11 `CLIPBOARD`: `text/html` target beside `UTF8_STRING`; the GTK shell serves the same pair through `gtk_clipboard_set_with_data` | synchronous calls return `ErrAsyncRequired`; `SetClipboardHTMLAsync` writes one `ClipboardItem` with both MIME flavours and needs a user gesture | | Copied files (`ClipboardFiles`, returns `[]string`) | the pasteboard's file URLs, file reference URLs resolved to paths; promised files have no path and are not listed | the `CF_HDROP` list (UTF-16 form) | X11 `CLIPBOARD`: `x-special/gnome-copied-files` (Nautilus, Nemo, Caja, Thunar) or `text/uri-list` (Dolphin, most toolkits); the GTK shell asks GTK for `text/uri-list` | `ErrUnsupported` | diff --git a/gfx/canvas.go b/gfx/canvas.go index 6f59dc917..3ec6643ae 100644 --- a/gfx/canvas.go +++ b/gfx/canvas.go @@ -682,12 +682,12 @@ type Hit struct { Layer uint16 Role Role Cursor PointerCursor - // CursorImage is HitOptions.CursorImage. - CursorImage *CursorImage // CursorImageAt is one plus the index in Canvas.cursorImageAts of // HitOptions.CursorImageAt, or 0 when the hit declared none. CursorImageAt int32 - Disabled bool + // CursorImage is HitOptions.CursorImage. + CursorImage *CursorImage + Disabled bool // FocusableDisabled is HitOptions.FocusableWhenDisabled. FocusableDisabled bool // SecondaryWhenDisabled is HitOptions.SecondaryWhenDisabled. @@ -713,6 +713,8 @@ type Hit struct { Range ValueRange // SkipTab is HitOptions.SkipTab. SkipTab bool + // DialogFooter identifies the button row that takes Left/Right and Home/End. + DialogFooter ID // Autofocus is HitOptions.Autofocus. Autofocus bool // Block marks an opaque region rather than a target: it has no ID and no @@ -850,6 +852,9 @@ type Canvas struct { // Components that draw content inside a menu use it to tell their own rows // from caller content under the pointer. hoveredRole Role + // hoveredDisabled is the disabled hit under the pointer, which is never the + // hovered one: it lets a tooltip describe a control that cannot be pressed. + hoveredDisabled ID // onSurface reports whether the pointer is on a surface declared with // Canvas.BlockSurface, which is opaque to presses but says the pointer is on // it. A menu row uses it to tell the menu's own padding from the world outside @@ -886,9 +891,10 @@ type Canvas struct { hasPointer bool consumed bool // nativeTextMenu is whether the window shows the system's text menu. - nativeTextMenu bool - listensForPointer bool - initialFocus ID + nativeTextMenu bool + listensForPointer bool + initialFocusVisible bool + initialFocus ID // focusRequest asks the runtime to focus one hit even without a trap, as a // non-modal popover does. The runtime honors a given request once, so // painting it every frame never pulls focus back after the user leaves. @@ -1141,6 +1147,7 @@ func (canvas *Canvas) Reset() { canvas.trappedScope = ID{} canvas.escapeTarget = ID{} canvas.initialFocus = ID{} + canvas.initialFocusVisible = false canvas.focusRequest = ID{} canvas.focusOnce = ID{} canvas.focusRelease = ID{} @@ -2144,11 +2151,21 @@ func (canvas *Canvas) FocusReturns() []ID { return canvas.focusReturns } // effect while the scope stays open, so painting it every frame never steals // focus back from the user. func (canvas *Canvas) SetInitialFocus(id ID) { + canvas.SetInitialFocusWithVisibility(id, false) +} + +// SetInitialFocusWithVisibility also chooses whether to show the focus ring +// when the scope gives id its initial focus. Later pointer and keyboard focus +// follow their usual presentation. +func (canvas *Canvas) SetInitialFocusWithVisibility(id ID, visible bool) { if depth := len(canvas.focusScopes); depth >= canvas.initialDepth { - canvas.initialFocus, canvas.initialDepth = id, depth + canvas.initialFocus, canvas.initialDepth, canvas.initialFocusVisible = id, depth, visible } } +// InitialFocusVisible reports whether the scope requested a ring on entry. +func (canvas *Canvas) InitialFocusVisible() bool { return canvas.initialFocusVisible } + // InitialFocus returns the hit named by SetInitialFocus, or zero. func (canvas *Canvas) InitialFocus() ID { return canvas.initialFocus @@ -2253,6 +2270,7 @@ func (canvas *Canvas) SetInteraction(hovered, pressed, focused ID, focusVisible canvas.hovered = hovered canvas.hoverFromLayout = false canvas.hoveredRole = 0 + canvas.hoveredDisabled = ID{} canvas.onSurface = false canvas.pressed = pressed canvas.focused = focused @@ -2289,6 +2307,20 @@ func (canvas *Canvas) SetHoveredRole(role Role) { canvas.hoveredRole = role } +// HoveredDisabled returns the disabled hit under the pointer, or the zero ID. A +// disabled control is never Hovered or Pressed and takes no click; it is +// reported here only so its Hint can still be shown, as the system's own +// controls show their tooltip while disabled. +func (canvas *Canvas) HoveredDisabled() ID { + return canvas.hoveredDisabled +} + +// SetHoveredDisabled records the disabled hit under the pointer. It is +// runtime-facing; application paint code should only read it. +func (canvas *Canvas) SetHoveredDisabled(id ID) { + canvas.hoveredDisabled = id +} + // PointerOnSurface reports whether the pointer is on a surface declared with // BlockSurface, such as the panel of an open menu. Unlike Hovered it is true over // the surface's padding and separators, which declare no control of their own. @@ -2498,13 +2530,21 @@ func (canvas *Canvas) RunAfterPaint() bool { func (canvas *Canvas) ListensForClicks() bool { return canvas.listensForClicks } // ClickInfo is what the runtime knows of the click an event pass delivers: the -// modifier keys held when it happened, and whether it was a double click (Clicks -// 2). The zero value is a plain click with no modifier, as Enter on a control is. +// modifier keys held when it happened, and how many presses of a quick sequence it +// closed (Clicks, as PointerEvent.ClickCount counts them). The zero value is a +// plain click with no modifier, as Enter on a control is. type ClickInfo struct { Modifiers Modifiers Clicks int } +// DoubleClick reports whether the click completes a double click: every second +// press of a sequence does, so the third press is a new single click, as it is +// in Finder and Explorer. A control that acts on a double click, such as opening +// a row, asks this instead of comparing Clicks, which keeps counting for text +// selection and would open the row again on a triple click. +func (info ClickInfo) DoubleClick() bool { return info.Clicks > 0 && info.Clicks%2 == 0 } + // BeginEventPass makes the next paint the event pass of a click on id, with what // the runtime knows of it: Clicked(id) is true in the pass, and ClickInfo says how // the click came. Pair it with EndEventPass around that one paint. The runtime does diff --git a/gfx/embed.go b/gfx/embed.go index 1b0d88bc5..1e2e76469 100644 --- a/gfx/embed.go +++ b/gfx/embed.go @@ -182,6 +182,9 @@ func (canvas *Canvas) Embed(child *Canvas, origin Point, mount Scope) { continue } hit.ID = tree.MountID(mount, hit.ID) + if !hit.DialogFooter.IsZero() { + hit.DialogFooter = tree.MountID(mount, hit.DialogFooter) + } if hit.Scope.IsZero() { hit.Scope = scope } else { @@ -224,7 +227,7 @@ func (canvas *Canvas) AdoptEmbedded(child *Canvas, mount Scope) { canvas.TrapFocus(tree.MountID(mount, scope)) } if focus := child.InitialFocus(); !focus.IsZero() { - canvas.SetInitialFocus(tree.MountID(mount, focus)) + canvas.SetInitialFocusWithVisibility(tree.MountID(mount, focus), child.InitialFocusVisible()) } if target := child.EscapeTarget(); !target.IsZero() { canvas.SetEscapeTarget(tree.MountID(mount, target)) diff --git a/gfx/embed_test.go b/gfx/embed_test.go index 038af6498..c31679ac2 100644 --- a/gfx/embed_test.go +++ b/gfx/embed_test.go @@ -337,13 +337,13 @@ func TestAdoptEmbeddedTakesTheViewsFocusAndModalState(t *testing.T) { mount := testMount(&page, 12) tree := page.Tree() view.TrapFocus(Item(23)) - view.SetInitialFocus(Item(1)) + view.SetInitialFocusWithVisibility(Item(1), true) view.SetEscapeTarget(Item(9)) view.RequestFocus(Item(4)) view.ReleaseFocus(Item(5)) page.AdoptEmbedded(&view, mount) if page.TrappedFocusScope() != tree.MountID(mount, Item(23)) || - page.InitialFocus() != tree.MountID(mount, Item(1)) || + page.InitialFocus() != tree.MountID(mount, Item(1)) || !page.InitialFocusVisible() || page.EscapeTarget() != tree.MountID(mount, Item(9)) || page.FocusRequest() != tree.MountID(mount, Item(4)) || page.FocusRelease() != tree.MountID(mount, Item(5)) { @@ -417,3 +417,16 @@ func TestEmbedMovesAQuadLabel(t *testing.T) { } } } + +// A double click is every second press of a sequence; the press after it +// starts a new single click. +func TestDoubleClickIsEverySecondPress(t *testing.T) { + for count, want := range map[int]bool{0: false, 1: false, 2: true, 3: false, 4: true, 5: false} { + if got := (ClickInfo{Clicks: count}).DoubleClick(); got != want { + t.Errorf("click %d: DoubleClick = %t, want %t", count, got, want) + } + if got := (PointerEvent{Kind: PointerDown, ClickCount: count}).DoubleClick(); got != want { + t.Errorf("press %d: DoubleClick = %t, want %t", count, got, want) + } + } +} diff --git a/gfx/input.go b/gfx/input.go index 98456f5fc..b4b93eaf5 100644 --- a/gfx/input.go +++ b/gfx/input.go @@ -119,7 +119,9 @@ const ( // ClickCount numbers consecutive presses of one button close together in time // and space, as the operating system defines a double click: 1 for a lone // press, 2 for the second press of a double click, 3 for a triple click. Down -// and Up events carry the count of their press; other events carry 0. +// and Up events carry the count of their press; other events carry 0. Text +// selection reads the count as it is; a control that acts on a double click asks +// DoubleClick. type PointerEvent struct { Kind PointerEventKind Button PointerButton @@ -142,6 +144,15 @@ type PointerEvent struct { PointerID int32 } +// DoubleClick reports whether the press, or its release, completes a double +// click: every second press of a sequence does, so the third is a new single click, as it is in +// Finder and Explorer. A control that acts on a double click, such as opening a +// row, asks this instead of comparing ClickCount, which keeps counting for text +// selection and would act again on a triple click. +func (event PointerEvent) DoubleClick() bool { + return ClickInfo{Clicks: event.ClickCount}.DoubleClick() +} + // Win32Key is the Windows console INPUT_RECORD data of a key event: the // virtual-key and scan codes, the UTF-16 code unit, the control-key state and // the repeat count. It is set only on Windows, and a terminal forwards it only diff --git a/gfx/motion.go b/gfx/motion.go index 3f7f4513f..5b736c3c8 100644 --- a/gfx/motion.go +++ b/gfx/motion.go @@ -410,6 +410,8 @@ type motionState struct { // frame; zero means none. wake time.Duration reduce bool + // inactive is set while the window is not the active one. + inactive bool // presences are the overlays that are open or still leaving, and open the // groups the current paint pass has begun and not yet ended (presence.go). presences []presenceEntry @@ -603,6 +605,20 @@ func (canvas *Canvas) SetReduceMotion(reduce bool) { canvas.motion.reduce = reduce } +// SetWindowActive records whether the window the canvas paints is the active +// one. A canvas is active until its runtime says otherwise, so a static preview +// or a test needs no call. +func (canvas *Canvas) SetWindowActive(active bool) { + canvas.motion.inactive = !active +} + +// WindowActive reports whether the window is the active one. Something that +// turns over on its own, like a text caret, rests while it is not, so a window +// in the background asks for no frames. +func (canvas *Canvas) WindowActive() bool { + return !canvas.motion.inactive +} + // ReduceMotion reports whether transitions are suppressed. func (canvas *Canvas) ReduceMotion() bool { return canvas.motion.reduce diff --git a/gfx/tabstop.go b/gfx/tabstop.go index c131a4973..1dc236b87 100644 --- a/gfx/tabstop.go +++ b/gfx/tabstop.go @@ -1,5 +1,23 @@ package gfx +// DialogFooter gives the buttons painted since from horizontal keyboard +// navigation within their row, leaving their ordinary Tab stops in place. +func (canvas *Canvas) DialogFooter(from Mark) { + var row ID + hits := canvas.HitsSince(from) + for i := range hits { + hit := &hits[i] + if hit.Role != RoleButton || !hit.Focusable || hit.SkipTab || hit.Disabled || hit.ID.IsZero() || + hit.Layer != from.layer || hit.Scope != from.scope { + continue + } + if row.IsZero() { + row = hit.ID + } + hit.DialogFooter = row + } +} + // OneTabStop makes the focusable hits declared since from one stop of Tab, as the // buttons of a toolbar or the tabs of a list are natively: Tab reaches the one that // has the focus, else last (the stop of the paint before), else the first, and the diff --git a/gfx/theme.go b/gfx/theme.go index cabbb94af..69628c017 100644 --- a/gfx/theme.go +++ b/gfx/theme.go @@ -56,6 +56,11 @@ func (m Metrics) RadiusItem() float32 { return max(m.RadiusControl-2, 0) } // dialog or card surface (RadiusSurface). func (m Metrics) RadiusPopup() float32 { return max(m.RadiusSurface-1, 0) } +// FocusRing is how far the keyboard focus halo reaches beyond a control's bounds. +// Every control draws its ring this wide, so focus reads the same as it moves from +// a button to a tab, a switch or a checkbox. +func (m Metrics) FocusRing() float32 { return 2 } + // RadiusOutset is the corner radius of a shape that stands by pixels outside one // of radius: a focus ring, a surface with a border around it, or a card larger // than a control. A square corner has nothing to follow and stays square, so a diff --git a/headless/application.go b/headless/application.go index fc6744eaf..70514a2d7 100644 --- a/headless/application.go +++ b/headless/application.go @@ -107,7 +107,13 @@ func (application *applicationSession) OpenWindow(config app.Config, canvas *gfx } config.OnWake = func() { if request := entry.fullscreenRequest.Swap(0); request != 0 { - if err := entry.session.driver.SetFullscreen(request == 2); err != nil { + var err error + if request == 3 { + err = entry.session.driver.SetFullscreenAllMonitors(true) + } else { + err = entry.session.driver.SetFullscreen(request == 2) + } + if err != nil { panic(err) } } @@ -175,21 +181,50 @@ func (window *headlessWindow) SetSize(width, height int) error { } func (window *headlessWindow) SetFullscreen(fullscreen bool) error { + request := int32(1) + if fullscreen { + request = 2 + } + return window.requestFullscreen(request) +} + +// SetFullscreenAllMonitors queues fullscreen over every simulated monitor; false +// is SetFullscreen(false). +func (window *headlessWindow) SetFullscreenAllMonitors(fullscreen bool) error { + if !fullscreen { + return window.SetFullscreen(false) + } + return window.requestFullscreen(3) +} + +func (window *headlessWindow) requestFullscreen(request int32) error { window.application.mu.Lock() entry := window.application.windows[window.id] window.application.mu.Unlock() if entry == nil { return fmt.Errorf("headless: window is closed") } - request := int32(1) - if fullscreen { - request = 2 - } entry.fullscreenRequest.Store(request) entry.invalidator.Invalidate() return nil } +// Monitors lists the simulated displays, which the monitors command defines. +func (window *headlessWindow) Monitors() ([]platform.Monitor, error) { + window.application.mu.Lock() + entry := window.application.windows[window.id] + window.application.mu.Unlock() + if entry == nil { + return nil, fmt.Errorf("headless: window is closed") + } + listed := entry.session.driver.Monitors() + monitors := make([]platform.Monitor, len(listed)) + for index, monitor := range listed { + monitors[index] = platform.Monitor(monitor) + } + return monitors, nil +} + // SetTitle records the title the windows command lists. func (window *headlessWindow) SetTitle(title string) error { window.application.mu.Lock() diff --git a/headless/control.go b/headless/control.go index b1235c25c..339049211 100644 --- a/headless/control.go +++ b/headless/control.go @@ -55,7 +55,11 @@ import ( // maximize on|off report the window as maximized or restored, as the window // manager would, and call OnMaximize // fullscreen on|off enter/leave a simulated native fullscreen window +// fullscreen all enter fullscreen across every monitor monitors defines // fullscreenmonitor x y w h full monitor bounds in logical pixels +// monitors X Y W H [X Y W H ...] +// the simulated displays in device pixels, the first the primary +// at 0 0; the driver's display scale is every display's scale // wait MS advance the animation clock // settle [MS] apply background work until quiet for MS (default 100) // waitfor "text" [MS] wait up to MS (default 5000) real ms for text on screen; @@ -443,9 +447,28 @@ func execute(session *Session, line string) (reply string, quit bool) { return finish(session.driver.SetFullscreen(true), "") case "off": return finish(session.driver.SetFullscreen(false), "") + case "all": + return finish(session.driver.SetFullscreenAllMonitors(true), "") default: - return finish(fmt.Errorf("fullscreen takes on or off"), "") + return finish(fmt.Errorf("fullscreen takes on, off or all"), "") } + case "monitors": + if len(arguments) == 0 || len(arguments)%4 != 0 { + return finish(fmt.Errorf("monitors takes X Y W H for each display"), "") + } + values, err := numbers(len(arguments)) + if err != nil { + return finish(err, "") + } + scale := session.options.Scale + monitors := make([]app.Monitor, 0, len(values)/4) + for index := 0; index < len(values); index += 4 { + monitors = append(monitors, app.Monitor{ + X: int(values[index]), Y: int(values[index+1]), Width: int(values[index+2]), Height: int(values[index+3]), + Scale: float32(scale), Primary: index == 0, + }) + } + return finish(session.driver.SetMonitors(monitors), "") case "fullscreenmonitor": bounds, err := numbers(4) if err != nil { diff --git a/headless/fullscreen_test.go b/headless/fullscreen_test.go index 9811cee7c..1f7d522ff 100644 --- a/headless/fullscreen_test.go +++ b/headless/fullscreen_test.go @@ -132,3 +132,44 @@ func TestFullscreenProtocolUsesMonitorBoundsAndRestores(t *testing.T) { t.Fatalf("invalid fullscreen command: %s", reply) } } + +func TestApplicationFullscreenAllMonitorsCoversTheListedDisplays(t *testing.T) { + host := newApplicationSession(Options{ReferenceText: true}) + var window *app.Window + app.UseApplicationRunner(func(start func(app.Host) error) error { return start(host) }) + defer app.UseApplicationRunner(nil) + err := app.RunApplication(func(application *app.Application) error { + var err error + window, err = application.OpenWindow(app.Config{Title: "span", Width: 500, Height: 300}, nil) + return err + }) + if err != nil { + t.Fatal(err) + } + defer host.closeAll() + driver := host.windows[1].session.driver + scale := driver.Monitors()[0].Scale + if err := driver.SetMonitors([]app.Monitor{ + {Width: 1920, Height: 1080, Scale: scale, Primary: true}, + {X: 1920, Width: 1280, Height: 1024, Scale: scale}, + }); err != nil { + t.Fatal(err) + } + monitors, err := window.Monitors() + if err != nil || len(monitors) != 2 || !monitors[0].Primary { + t.Fatalf("window.Monitors = %+v, %v", monitors, err) + } + if err := window.SetFullscreenAllMonitors(true); err != nil { + t.Fatal(err) + } + if window.Fullscreen() { + t.Fatal("the request ran off the driver thread") + } + if err := driver.Pump(); err != nil { + t.Fatal(err) + } + frame, _ := window.Frame() + if !window.Fullscreen() || frame.Width != float32(1920+1280)/scale || frame.Height != float32(1080)/scale { + t.Fatalf("spanning window = %v, %+v", window.Fullscreen(), frame) + } +} diff --git a/headless/render_darwin.go b/headless/render_darwin.go index a3ea6c820..34ed46d59 100644 --- a/headless/render_darwin.go +++ b/headless/render_darwin.go @@ -58,11 +58,11 @@ func (r *renderer) render(snapshot app.Snapshot, scale float64) (*image.RGBA, er if err != nil { return nil, err } - // Metal wrote BGRA; the frame is opaque. + // Metal wrote premultiplied BGRA, including the window's transparency. picture := image.NewRGBA(image.Rect(0, 0, width, height)) for index := 0; index+3 < len(pixels); index += 4 { picture.Pix[index], picture.Pix[index+1], picture.Pix[index+2], picture.Pix[index+3] = - pixels[index+2], pixels[index+1], pixels[index], 255 + pixels[index+2], pixels[index+1], pixels[index], pixels[index+3] } return picture, nil } diff --git a/headless/transparency_darwin_test.go b/headless/transparency_darwin_test.go new file mode 100644 index 000000000..143f00993 --- /dev/null +++ b/headless/transparency_darwin_test.go @@ -0,0 +1,53 @@ +//go:build darwin && vivahead && !ios + +package headless + +import ( + "testing" + + "github.com/vivaui/viva/app" + "github.com/vivaui/viva/gfx" +) + +func TestScreenshotPreservesTransparencyAcrossFrames(t *testing.T) { + for _, scale := range []float64{1, 2} { + showInk := true + var invalidator app.Invalidator + session, err := Open(app.Config{ + Width: 80, Height: 60, WindowMode: app.WindowFrameless, + Transparent: true, ClearColor: app.Color{}, + Invalidator: &invalidator, + Paint: func(canvas *gfx.Canvas, size gfx.Size) { + canvas.Fill(gfx.Rect{Width: 40, Height: 60}, gfx.Color{Alpha: 0.35}) + if showInk { + canvas.Fill(gfx.Rect{X: 8, Y: 8, Width: 8, Height: 8}, gfx.RGB(255, 255, 255)) + } + }, + }, nil, Options{Scale: scale}) + if err != nil { + t.Fatal(err) + } + func() { + defer session.Close() + for _, ink := range []bool{true, false, true, false} { + showInk = ink + invalidator.Invalidate() + picture, err := session.Image() + if err != nil { + t.Fatal(err) + } + pixel := picture.RGBAAt(int(12*scale), int(12*scale)) + if ink { + if pixel.A != 255 || pixel.R != 255 { + t.Fatalf("%gx: visible ink = %v", scale, pixel) + } + } else if pixel.A < 88 || pixel.A > 90 || pixel.R != 0 { + t.Fatalf("%gx: removed ink = %v, want translucent black", scale, pixel) + } + if pixel := picture.RGBAAt(int(60*scale), int(30*scale)); pixel.A != 0 { + t.Fatalf("%gx: clear pixel = %v, want zero alpha", scale, pixel) + } + } + }() + } +} diff --git a/internal/input/input.go b/internal/input/input.go index bfec023b2..85166544f 100644 --- a/internal/input/input.go +++ b/internal/input/input.go @@ -125,9 +125,10 @@ type KeyEvent struct { // Result reports state changes and semantic activation caused by an event. type Result struct { - Target Target - FocusChanged bool - Activated bool + Target Target + FocusChanged bool + Activated bool + FooterTraversal bool } // Router retains hit regions and keyboard focus independently from platform @@ -142,12 +143,27 @@ type Router struct { // merely announced again. activeInitial Target returnFocus Target + footerButtons []footerButton +} + +type footerButton struct { + row, button gfx.ID } // RegionBuffer is the router's region list emptied, to build the next list in // and hand back with SetRegions, so the regions are kept once and never copied. +// It also clears the previous paint's footer membership. // The router routes nothing until it has them back. -func (router *Router) RegionBuffer() []Region { return router.regions[:0] } +func (router *Router) RegionBuffer() []Region { + router.footerButtons = router.footerButtons[:0] + return router.regions[:0] +} + +// AddFooterButton records an enabled member of the active dialog's footer +// in paint order. Other regions need no row identity. +func (router *Router) AddFooterButton(row, button gfx.ID) { + router.footerButtons = append(router.footerButtons, footerButton{row, button}) +} // SetRegions replaces the paint-order hit regions, preserving a still-valid // focused target. The router keeps regions as given, without a copy: the caller @@ -231,6 +247,38 @@ func (router *Router) PointerAt(x float32, y float32, secondaryPress bool) (Regi return Region{}, false, false } +// DisabledAt is the disabled control the pointer rests on, or zero. It is the +// front-most region under the point, and it counts only while no enabled +// control or opaque surface lies in front of it, so it names what the user +// sees under the pointer. A disabled control is never the hovered target +// PointerAt returns; this is how the application learns of it to describe it. +func (router *Router) DisabledAt(x float32, y float32) Target { + for index := len(router.regions) - 1; index >= 0; index-- { + region := router.regions[index] + if !contains(region.Bounds, x, y) { + continue + } + if region.Blocks { + if router.activeScope.IsZero() || region.Scope == router.activeScope { + return Target{} + } + continue + } + if region.Label || region.Target.IsZero() || !router.scopeAvailable(region) { + continue + } + if region.Disabled { + return region.Target + } + return Target{} + } + return Target{} +} + +func (router *Router) scopeAvailable(region Region) bool { + return router.activeScope.IsZero() || region.Scope == router.activeScope +} + // TouchPoint is where a finger that touched at x, y presses. A fingertip is about 44 // logical pixels across and a control may be smaller, so a touch that lands near a // small control, not on it, presses the control rather than what is behind it: the @@ -426,6 +474,12 @@ func (router *Router) KeyDown(event KeyEvent) Result { if event.Key == KeyTab { return router.moveFocus(event.Modifiers&ModifierShift != 0) } + if event.Modifiers == 0 && len(router.footerButtons) != 0 { + switch event.Key { + case KeyLeft, KeyRight, KeyHome, KeyEnd: + return router.moveFooterFocus(event.Key) + } + } if !event.Repeat && (event.Key == KeyEnter || event.Key == KeySpace) && !router.focused.IsZero() { if region, ok := router.focusedRegion(); ok { if region.Disabled || !activatesOn(region.Role, event.Key) { @@ -546,6 +600,36 @@ func (router *Router) Focused() (Target, bool) { return router.focused, !router.focused.IsZero() } +func (router *Router) moveFooterFocus(key Key) Result { + buttons := router.footerButtons + for index, current := range buttons { + if current.button != router.focused { + continue + } + step := 1 + if key == KeyLeft || key == KeyEnd { + step = -1 + } + if key == KeyHome { + index = len(buttons) - 1 + } else if key == KeyEnd { + index = 0 + } + for range buttons { + index = (index + step + len(buttons)) % len(buttons) + next := buttons[index] + if next.row != current.row { + continue + } + if moved := router.Focus(next.button); moved || next.button == router.focused { + return Result{Target: next.button, FocusChanged: moved, FooterTraversal: true} + } + } + break + } + return Result{Target: router.focused} +} + func (router *Router) moveFocus(reverse bool) Result { count := len(router.regions) if count == 0 { diff --git a/internal/input/input_test.go b/internal/input/input_test.go index 45f82527c..eeb3cb494 100644 --- a/internal/input/input_test.go +++ b/internal/input/input_test.go @@ -136,6 +136,37 @@ func TestSecondaryPressFindsADisabledRegionWithoutAllocating(t *testing.T) { } } +func TestDisabledAtNamesOnlyWhatLiesInFront(t *testing.T) { + var router Router + router.SetRegions([]Region{ + {Target: gfx.Item(1), Bounds: Rect{Width: 100, Height: 100}}, + {Target: gfx.Item(2), Bounds: Rect{Width: 50, Height: 50}, Disabled: true}, + {Target: gfx.Item(3), Bounds: Rect{X: 25, Width: 25, Height: 50}}, + {Bounds: Rect{Y: 60, Width: 50, Height: 40}, Blocks: true}, + {Target: gfx.Item(4), Bounds: Rect{Y: 60, Width: 50, Height: 40}, Disabled: true}, + }) + for _, test := range []struct { + name string + x, y float32 + want gfx.ID + }{ + {"disabled over an enabled one", 10, 10, gfx.Item(2)}, + {"enabled control in front", 30, 10, gfx.ID{}}, + {"enabled only", 80, 80, gfx.ID{}}, + {"outside", 200, 200, gfx.ID{}}, + } { + if got := router.DisabledAt(test.x, test.y); got != test.want { + t.Errorf("%s: DisabledAt = %v, want %v", test.name, got, test.want) + } + if got, _, _ := router.PointerAt(test.x, test.y, false); got.Disabled { + t.Errorf("%s: PointerAt returned a disabled region", test.name) + } + } + if allocs := testing.AllocsPerRun(100, func() { router.DisabledAt(10, 10) }); allocs != 0 { + t.Fatalf("DisabledAt allocates %v times per call", allocs) + } +} + func BenchmarkPassesSecondary10K(b *testing.B) { regions := make([]Region, 10_000) for index := range regions { diff --git a/internal/interaction/focus.go b/internal/interaction/focus.go index 588b7d5af..9451f0663 100644 --- a/internal/interaction/focus.go +++ b/internal/interaction/focus.go @@ -15,6 +15,7 @@ type Focus struct { router input.Router focused gfx.ID keyboardFocus bool + initialRing bool pendingFocus gfx.ID pendingVisible bool // focusClaim is the non-modal focus request already honored, so a popover @@ -49,12 +50,11 @@ func (f *Focus) Router() *input.Router { return &f.router } // Focused returns the target that owns the keyboard, or zero. func (f *Focus) Focused() gfx.ID { return f.focused } -// KeyboardFocus reports whether the focus ring is visible because the keyboard -// moved focus, as opposed to a pointer click. -func (f *Focus) KeyboardFocus() bool { return f.keyboardFocus } +// KeyboardFocus reports whether the focused control shows its ring. +func (f *Focus) KeyboardFocus() bool { return f.keyboardFocus || f.initialRing } // SetKeyboardFocus changes how focus is presented without moving it. -func (f *Focus) SetKeyboardFocus(visible bool) { f.keyboardFocus = visible } +func (f *Focus) SetKeyboardFocus(visible bool) { f.keyboardFocus, f.initialRing = visible, false } // Carry keeps the focus request the paint that just ended as an event pass made, // so the repaint that follows applies it. Canvas.Reset clears a request between @@ -83,7 +83,7 @@ func (f *Focus) PaintTarget() (gfx.ID, bool) { if !f.pendingFocus.IsZero() { return f.pendingFocus, f.pendingVisible } - return f.focused, f.keyboardFocus + return f.focused, f.KeyboardFocus() } // EscapeTarget returns the control Escape dismisses, or zero. @@ -105,12 +105,16 @@ func (f *Focus) WasPainted(id gfx.ID) bool { func (f *Focus) Sync(canvas *gfx.Canvas) { before := f.focused regions := f.router.RegionBuffer() + scope := canvas.TrappedFocusScope() hits := canvas.Hits() for index := range hits { hit := &hits[index] if hit.Container { continue // semantic regions are not interaction targets } + if !hit.DialogFooter.IsZero() && !hit.Disabled && !hit.SkipTab && hit.Focusable && (scope.IsZero() || hit.Scope == scope) { + f.router.AddFooterButton(hit.DialogFooter, hit.ID) + } regions = append(regions, input.Region{ Target: input.Target(hit.ID), Bounds: input.Rect{X: hit.Bounds.X, Y: hit.Bounds.Y, Width: hit.Bounds.Width, Height: hit.Bounds.Height}, @@ -139,7 +143,9 @@ func (f *Focus) Sync(canvas *gfx.Canvas) { } f.router.SetRegions(regions) f.syncReturns(canvas.FocusReturns(), before) - f.router.SetActiveScope(canvas.TrappedFocusScope(), input.Target(canvas.InitialFocus())) + initial := canvas.InitialFocus() + newScope := scope != f.router.ActiveScope() + placed := f.router.SetActiveScope(scope, input.Target(initial)) f.applyAutofocus(hits) request := canvas.FocusRequest() once := canvas.TakeFocusOnce() @@ -184,6 +190,13 @@ func (f *Focus) Sync(canvas *gfx.Canvas) { } f.escape = canvas.EscapeTarget() f.refresh() + // The ring belongs to the scope's initial placement, independently of how + // the opener was focused. Do not give it to the opener on return. + if newScope || placed { + f.initialRing = !scope.IsZero() && canvas.InitialFocusVisible() && !initial.IsZero() && f.focused == initial + } else if f.focused != before { + f.initialRing = false + } f.noteInside() } @@ -232,7 +245,7 @@ func (f *Focus) noteInside() { // Apply carries out the focus part of an event result. It reports whether the // focused target or the presentation of focus changed. func (f *Focus) Apply(result gfx.EventResult) bool { - before, beforeVisible := f.focused, f.keyboardFocus + before, beforeVisible := f.focused, f.KeyboardFocus() if result.Blur { f.pendingFocus = gfx.ID{} f.pendingVisible = false @@ -251,11 +264,11 @@ func (f *Focus) Apply(result gfx.EventResult) bool { } f.refresh() if f.focused != before { - f.keyboardFocus = result.FocusVisible && !f.focused.IsZero() + f.SetKeyboardFocus(result.FocusVisible && !f.focused.IsZero()) } else if !result.Focus.IsZero() || result.Blur { - f.keyboardFocus = result.FocusVisible && !f.focused.IsZero() + f.SetKeyboardFocus(result.FocusVisible && !f.focused.IsZero()) } - return f.focused != before || f.keyboardFocus != beforeVisible || !f.pendingFocus.IsZero() + return f.focused != before || f.KeyboardFocus() != beforeVisible || !f.pendingFocus.IsZero() } // PointerDown applies the focus rule of a press: the hit under the pointer takes @@ -267,7 +280,7 @@ func (f *Focus) PointerDown(x, y float32, target gfx.ID) { f.router.Blur() } f.refresh() - f.keyboardFocus = false + f.SetKeyboardFocus(false) } // Refresh copies the router's current focus into the cached value. Callers use diff --git a/internal/interaction/interaction_test.go b/internal/interaction/interaction_test.go index ba2cf3ce7..d885098fa 100644 --- a/internal/interaction/interaction_test.go +++ b/internal/interaction/interaction_test.go @@ -68,6 +68,41 @@ func TestFocusKeepsAFocusedTargetAcrossRepaints(t *testing.T) { } } +func TestDialogFooterMembershipFollowsTheCurrentPaint(t *testing.T) { + var canvas gfx.Canvas + var focus Focus + paint := func(grouped bool) { + canvas.Reset() + for _, pair := range [][2]int{{1, 2}, {3, 4}} { + row := canvas.Mark() + for _, id := range pair { + canvas.Hit(gfx.Item(id), gfx.Rect{Width: 40, Height: 40}) + } + if grouped { + canvas.DialogFooter(row) + } + } + focus.Sync(&canvas) + } + paint(true) + focus.Apply(gfx.EventResult{Focus: gfx.Item(2)}) + right := input.KeyEvent{Key: input.KeyRight} + if result := focus.Router().KeyDown(right); result.Target != gfx.Item(1) || !result.FooterTraversal { + t.Fatalf("Right should wrap in its own footer: %+v", result) + } + if n := testing.AllocsPerRun(100, func() { + focus.Sync(&canvas) + focus.Router().KeyDown(right) + }); n != 0 { + t.Fatalf("repainting and traversing a footer allocated %v times", n) + } + before, _ := focus.Router().Focused() + paint(false) + if result := focus.Router().KeyDown(right); result.Target != before || result.FooterTraversal { + t.Fatalf("ordinary buttons retained their old footer: %+v", result) + } +} + func TestPendingFocusUsesTheRevealedPaint(t *testing.T) { var canvas gfx.Canvas var focus Focus diff --git a/internal/interaction/pointer.go b/internal/interaction/pointer.go index 3c5687cae..ba024f632 100644 --- a/internal/interaction/pointer.go +++ b/internal/interaction/pointer.go @@ -9,6 +9,7 @@ import "github.com/vivaui/viva/gfx" type Pointer struct { hovered gfx.ID hoveredRole gfx.Role + disabled gfx.ID pressed gfx.ID target gfx.ID button gfx.PointerButton @@ -21,6 +22,13 @@ func (p *Pointer) SetHovered(target gfx.ID) { p.hovered = target } // SetHoveredRole records the role of the hovered hit. func (p *Pointer) SetHoveredRole(role gfx.Role) { p.hoveredRole = role } +// SetHoveredDisabled records the disabled hit under the pointer, or zero. It is +// never a press target: it exists so the control can still be described. +func (p *Pointer) SetHoveredDisabled(target gfx.ID) { p.disabled = target } + +// HoveredDisabled returns the disabled hit under the pointer. +func (p *Pointer) HoveredDisabled() gfx.ID { return p.disabled } + // Hovered returns the hit under the pointer. func (p *Pointer) Hovered() gfx.ID { return p.hovered } @@ -79,6 +87,7 @@ func (p *Pointer) Up() { p.reset() } func (p *Pointer) Exit() { p.reset() p.hovered = gfx.ID{} + p.disabled = gfx.ID{} } func (p *Pointer) reset() { diff --git a/internal/platform/clipboard_files.go b/internal/platform/clipboard_files.go index 353c15cfa..238fab96c 100644 --- a/internal/platform/clipboard_files.go +++ b/internal/platform/clipboard_files.go @@ -133,4 +133,18 @@ func FileURIList(paths []string) []byte { return []byte(list.String()) } +// GnomeCopiedFiles builds the x-special/gnome-copied-files form Nautilus, Nemo +// and Caja read: the action, then one URL per line. Unlike text/uri-list, the +// lines end in a bare LF and the last one has no line ending, because those +// readers split on LF alone and take every piece as a file, so a carriage +// return or a trailing newline names a file that does not exist. +func GnomeCopiedFiles(paths []string) []byte { + list := []byte("copy") + for _, path := range paths { + list = append(list, '\n') + list = append(list, (&url.URL{Scheme: "file", Path: path}).String()...) + } + return list +} + func utf16ToString(units []uint16) string { return string(utf16.Decode(units)) } diff --git a/internal/platform/clipboard_files_test.go b/internal/platform/clipboard_files_test.go index debaf7552..94ecc625c 100644 --- a/internal/platform/clipboard_files_test.go +++ b/internal/platform/clipboard_files_test.go @@ -89,3 +89,22 @@ func TestFileURIListReadsBackAsTheSamePaths(t *testing.T) { t.Fatalf("FileURIList round trip = %q, want %q", got, want) } } + +func TestGnomeCopiedFilesIsReadableByLFSplittingFileManagers(t *testing.T) { + want := []string{"/tmp/a b.txt", "/home/u/中.txt", "/tmp/dir"} + data := GnomeCopiedFiles(want) + // Nautilus, Nemo and Caja split on LF alone and open every line after the + // action as a file: no carriage return and no empty trailing line. + lines := strings.Split(string(data), "\n") + if lines[0] != "copy" || len(lines) != len(want)+1 { + t.Fatalf("GnomeCopiedFiles lines = %q", lines) + } + for _, line := range lines[1:] { + if !strings.HasPrefix(line, "file:///") || strings.ContainsAny(line, "\r ") { + t.Fatalf("GnomeCopiedFiles line %q is not a bare file URL", line) + } + } + if got := FilesFromURIList(data); !slices.Equal(got, want) { + t.Fatalf("GnomeCopiedFiles round trip = %q, want %q", got, want) + } +} diff --git a/internal/platform/contract.go b/internal/platform/contract.go index 216ab8742..04abd4070 100644 --- a/internal/platform/contract.go +++ b/internal/platform/contract.go @@ -289,6 +289,22 @@ var ErrNoGraphics = errors.New("platform: no graphics driver") // ErrFullscreenUnsupported means this host or window kind cannot go fullscreen. var ErrFullscreenUnsupported = errors.New("platform: fullscreen is unsupported") +// ErrFullscreenAllMonitorsUnsupported means this host cannot make one window +// cover every monitor: a Wayland compositor decides where a window goes and has +// no way to span outputs, and a window kind may have no fullscreen at all. +var ErrFullscreenAllMonitorsUnsupported = errors.New("platform: fullscreen on all monitors is unsupported") + +// Monitor is one display of the desktop, in device pixels of the virtual +// screen: the primary display's top-left corner is the origin, so a display +// left of or above it has a negative X or Y. +type Monitor struct { + X, Y, Width, Height int + // Scale is the display's device pixels per logical pixel. + Scale float32 + // Primary marks the display the desktop's origin is on. + Primary bool +} + // ErrAlwaysOnTopUnsupported means this host or window kind cannot keep a window // above others. var ErrAlwaysOnTopUnsupported = errors.New("platform: always-on-top is unsupported") diff --git a/internal/platform/darwin/clipboard_sensitive_darwin.go b/internal/platform/darwin/clipboard_sensitive_darwin.go new file mode 100644 index 000000000..1f1d44dcb --- /dev/null +++ b/internal/platform/darwin/clipboard_sensitive_darwin.go @@ -0,0 +1,64 @@ +//go:build darwin && !ios + +package darwin + +/* +#include +#include "system_darwin.h" +*/ +import "C" + +import "unsafe" + +// SetSensitiveClipboardText writes value to the general pasteboard restricted to +// the current host and marked with org.nspasteboard.ConcealedType and +// org.nspasteboard.TransientType, returning a clear function that empties the +// pasteboard only if its changeCount still matches this write. +func SetSensitiveClipboardText(value string) (func() (bool, error), error) { + return putPasteboardSensitiveText(nil, value) +} + +func putPasteboardSensitiveText(name *C.char, value string) (func() (bool, error), error) { + nativeValue, err := systemCString("clipboard text", value) + if err != nil { + return nil, err + } + defer C.free(unsafe.Pointer(nativeValue)) + var count C.long + var nativeError *C.char + if C.viva_system_pasteboard_put_sensitive_text(name, nativeValue, &count, &nativeError) != 0 { + return nil, systemError("set sensitive clipboard", nativeError) + } + var boardName string + hasName := name != nil + if hasName { + boardName = C.GoString(name) + } + return func() (bool, error) { + var cName *C.char + if hasName { + cName = C.CString(boardName) + defer C.free(unsafe.Pointer(cName)) + } + var cleared C.int + var clearErr *C.char + if C.viva_system_pasteboard_clear_if_count(cName, count, &cleared, &clearErr) != 0 { + return false, systemError("clear sensitive clipboard", clearErr) + } + return cleared != 0, nil + }, nil +} + +func putPrivatePasteboardSensitiveText(name, value string) (func() (bool, error), error) { + cName := C.CString(name) + defer C.free(unsafe.Pointer(cName)) + return putPasteboardSensitiveText(cName, value) +} + +func privatePasteboardHasType(name, uti string) bool { + cName := C.CString(name) + defer C.free(unsafe.Pointer(cName)) + cUTI := C.CString(uti) + defer C.free(unsafe.Pointer(cUTI)) + return C.viva_system_pasteboard_has_type(cName, cUTI) != 0 +} diff --git a/internal/platform/darwin/clipboard_sensitive_darwin_test.go b/internal/platform/darwin/clipboard_sensitive_darwin_test.go new file mode 100644 index 000000000..86655ed7c --- /dev/null +++ b/internal/platform/darwin/clipboard_sensitive_darwin_test.go @@ -0,0 +1,49 @@ +//go:build darwin && !ios + +package darwin + +import "testing" + +func TestPasteboardSensitiveTextMarksConcealedAndClearsOnlyAtSameChangeCount(t *testing.T) { + name := privateName(t) + clearFn, err := putPrivatePasteboardSensitiveText(name, "s3cret-pass-中") + if err != nil { + t.Fatal(err) + } + if text, err := privatePasteboardText(name); err != nil || text != "s3cret-pass-中" { + t.Fatalf("pasteboard text = %q, %v, want secret", text, err) + } + for _, uti := range []string{"org.nspasteboard.ConcealedType", "org.nspasteboard.TransientType"} { + if !privatePasteboardHasType(name, uti) { + t.Fatalf("pasteboard missing concealment type %q", uti) + } + } + + // Untouched pasteboard: clear empties it and reports true. + cleared, err := clearFn() + if err != nil || !cleared { + t.Fatalf("clear unchanged: cleared=%v err=%v, want true, nil", cleared, err) + } + if text, err := privatePasteboardText(name); err != nil || text != "" { + t.Fatalf("after clear: text=%q err=%v, want empty", text, err) + } + + // Replaced pasteboard: clear leaves the replacement untouched and reports false. + clearFn2, err := putPrivatePasteboardSensitiveText(name, "second-secret") + if err != nil { + t.Fatal(err) + } + if err := putPrivatePasteboardHTML(name, "keep", "keep"); err != nil { + t.Fatal(err) + } + if privatePasteboardHasType(name, "org.nspasteboard.ConcealedType") { + t.Fatal("replacement copy retained org.nspasteboard.ConcealedType") + } + cleared, err = clearFn2() + if err != nil || cleared { + t.Fatalf("clear after replacement: cleared=%v err=%v, want false, nil", cleared, err) + } + if text, err := privatePasteboardText(name); err != nil || text != "keep" { + t.Fatalf("pasteboard after skipped clear = %q, %v, want keep", text, err) + } +} diff --git a/internal/platform/darwin/native.h b/internal/platform/darwin/native.h index 1372bab9b..c50420746 100644 --- a/internal/platform/darwin/native.h +++ b/internal/platform/darwin/native.h @@ -420,6 +420,23 @@ void viva_application_move_window(void *window, double x, double y); /* Posts a content resize to the AppKit event loop. */ void viva_application_set_window_size(void *window, double width, double height); int viva_application_set_fullscreen(void *window, int fullscreen); +/* Makes the window fullscreen over every screen. Returns 1 when accepted, 0 when + * there is no such window, -1 for a panel and -2 when the screens are separate + * Spaces, where one window cannot cover them; the window is then untouched. */ +int viva_application_set_fullscreen_all_monitors(void *window); +/* One display of the desktop in Cocoa points with the origin at the top-left of + * the primary display (y down), and the display's pixels per point. */ +typedef struct { + double x; + double y; + double width; + double height; + double scale; + int primary; +} viva_monitor; +/* Writes up to capacity displays, the primary first, and returns how many there + * are. Safe from any thread; off the main thread it waits for it. */ +int viva_monitors(viva_monitor *out, int capacity); int viva_application_set_title(void *window, const char *title); int viva_application_fullscreen(void *window); int viva_application_set_always_on_top(void *window, int enabled); diff --git a/internal/platform/darwin/native.m b/internal/platform/darwin/native.m index e9d9988bd..0388fc2ba 100644 --- a/internal/platform/darwin/native.m +++ b/internal/platform/darwin/native.m @@ -94,6 +94,10 @@ static CGFloat viva_traffic_light_center(NSWindow *window) { return NSHeight(window.frame) - NSMidY(button); } +/* Whether the window is spanning every screen (see VivaAppDelegate + * enterSpan). Defined with VivaWorkspaceWindow, which holds the flag. */ +static BOOL viva_window_spans_screens(NSWindow *window); + /* Centers the traffic lights in a custom titlebar strip taller than the * system's own: the titlebar container grows to the strip, so the buttons stay * inside it and clickable, and each button is set that far below the top. @@ -1434,6 +1438,14 @@ - (instancetype)initWithFrame:(NSRect)frame _metalLayer.device = device; _metalLayer.pixelFormat = MTLPixelFormatBGRA8Unorm; _metalLayer.framebufferOnly = YES; + /* The renderer writes sRGB values into a non-sRGB-encoded format. An + * untagged layer is sent to the display unmatched, so a panel with a + * non-sRGB profile shows flat tints differently (and can band or + * flicker) from every tagged app; naming the space lets the system + * match it as it does for other windows. */ + CGColorSpaceRef layerSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); + _metalLayer.colorspace = layerSpace; + CGColorSpaceRelease(layerSpace); /* A transparent clear color must reach the desktop through a frameless * surface. Opaque titled windows keep the normal fast path. */ _metalLayer.opaque = clearColor.alpha >= 1.0 && windowMode != VIVA_WINDOW_PANEL && windowMode != VIVA_WINDOW_PREVIEW; @@ -1516,7 +1528,7 @@ - (void)dealloc { - (BOOL)isOpaque { - return _windowMode != VIVA_WINDOW_PANEL && _windowMode != VIVA_WINDOW_PREVIEW && _windowMode != VIVA_WINDOW_NOTIFICATION; + return _metalLayer.isOpaque && _windowMode != VIVA_WINDOW_NOTIFICATION; } - (BOOL)acceptsFirstResponder { @@ -1610,7 +1622,7 @@ - (void)mouseDown:(NSEvent *)event { [self.window makeFirstResponder:self]; } int press = VIVA_PRESS_CLIENT; - if ((self.window.styleMask & NSWindowStyleMaskFullScreen) == 0 && + if ((self.window.styleMask & NSWindowStyleMaskFullScreen) == 0 && !viva_window_spans_screens(self.window) && (_windowMode == VIVA_WINDOW_CUSTOM_TITLEBAR || _windowMode == VIVA_WINDOW_FRAMELESS || _windowMode == VIVA_WINDOW_NOTIFICATION) && _callbackHandle != 0) { // The application declares where the window moves from (a move region). NSPoint local = [self convertPoint:event.locationInWindow fromView:nil]; @@ -2975,6 +2987,15 @@ - (void)setMarkedText:(id)string selectedRange:selectedRange replacementRange:replacementRange command:0]; + if (plain.length == 0 && _hasMarkedText) { + // AppKit has no separate end of composition: an input method that + // clears its marked text (Backspace over the last letter, or Command+ + // Delete in some) has stopped composing, as NSTextView takes it. The + // editor answers the empty mark with an empty composition, so it is + // committed here; left open, hasMarkedText would keep telling the + // input method there is one, and it would take the next keys for it. + [self unmarkText]; + } } - (void)unmarkText { @@ -3540,10 +3561,33 @@ int viva_start_file_promise_drag(intptr_t drag, const viva_drag_item *items, siz /* A frameless workspace still owns keyboard focus and the application's main * window role. A plain borderless NSWindow declines both by default. */ +@protocol VivaSpanningWindowOwner +- (void)spanningWindowRequestsLeave; +@end + +/* A window that spans every screen is borderless, and AppKit must neither clamp + * its frame to one screen nor let toggleFullScreen: turn it into a native full + * screen window of one screen: the owner takes it back to the normal window + * instead. */ @interface VivaWorkspaceWindow : NSWindow +@property(nonatomic, assign) BOOL spansScreens; @end +static BOOL viva_window_spans_screens(NSWindow *window) { + return [window isKindOfClass:[VivaWorkspaceWindow class]] && ((VivaWorkspaceWindow *)window).spansScreens; +} + @implementation VivaWorkspaceWindow +- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen { + return self.spansScreens ? frameRect : [super constrainFrameRect:frameRect toScreen:screen]; +} +- (void)toggleFullScreen:(id)sender { + if (self.spansScreens && [self.delegate conformsToProtocol:@protocol(VivaSpanningWindowOwner)]) { + [(id)self.delegate spanningWindowRequestsLeave]; + return; + } + [super toggleFullScreen:sender]; +} - (BOOL)canBecomeKeyWindow { return (self.styleMask & NSWindowStyleMaskTitled) == 0 || [super canBecomeKeyWindow]; } @@ -3581,7 +3625,16 @@ - (BOOL)canBecomeMainWindow { } @end -@interface VivaAppDelegate : NSObject { +/* The bounding box of every screen, in Cocoa's bottom-left screen coordinates. */ +static NSRect viva_screens_union(void) { + NSRect union_ = NSZeroRect; + for (NSScreen *screen in NSScreen.screens) { + union_ = NSIsEmptyRect(union_) ? screen.frame : NSUnionRect(union_, screen.frame); + } + return union_; +} + +@interface VivaAppDelegate : NSObject { viva_watermark _initialWatermark; NSString *_initialWatermarkText; NSString *_initialWatermarkFamily; @@ -3623,6 +3676,12 @@ @interface VivaAppDelegate : NSObject NSMutableArray *_titlebarWatched; /* views whose frame changes re-center the traffic lights */ BOOL _fullscreenTarget; BOOL _fullscreenTransition; + BOOL _fullscreenReported; /* what OnFullscreen last said */ + BOOL _spanning; /* borderless over every screen, outside native full screen */ + BOOL _spanPending; /* leaving native full screen to span */ + NSRect _spanFrame; + NSWindowStyleMask _spanStyle; + NSApplicationPresentationOptions _spanPresentation; BOOL _changingDecoration; NSWindowStyleMask _decoratedStyle; BOOL _decoratedTitlebarTransparent; @@ -3667,6 +3726,7 @@ - (void)confirmClose; - (void)hideWindow; - (void)showWindow; - (void)setFullscreen:(BOOL)fullscreen; +- (int)setFullscreenAllMonitors; - (int)changeDecoration:(BOOL)decorated; - (void)setWindowTitle:(NSString *)title; - (void)setAlwaysOnTop:(BOOL)enabled; @@ -4083,6 +4143,9 @@ - (void)windowWillClose:(NSNotification *)notification { if ([_window.contentView isKindOfClass:[VivaMetalView class]]) { [(VivaMetalView *)_window.contentView detachCallbacks]; } + if (_spanning) { /* the menu bar and the Dock come back with the window */ + [self endSpanSession]; + } _running = NO; if (_callbackHandle != 0) { uintptr_t callbackHandle = _callbackHandle; @@ -4187,6 +4250,9 @@ - (void)windowDidChangeScreenProfile:(NSNotification *)notification { - (void)screenParametersChanged:(NSNotification *)notification { (void)notification; [self updateMinimumSize]; + if (_spanning) { + [_window setFrame:viva_screens_union() display:YES]; + } } /* Reports the content rectangle on screen after a move or a resize. The frame is @@ -4232,10 +4298,28 @@ - (void)windowDidChangeOcclusionState:(NSNotification *)notification { } } +/* Whether the window is fullscreen in either form: AppKit's native full screen + * of one screen, or spanning every screen. */ - (BOOL)isFullscreen { + return _spanning || [self isNativeFullscreen]; +} + +- (BOOL)isNativeFullscreen { return (_window.styleMask & NSWindowStyleMaskFullScreen) != 0; } +/* Tells OnFullscreen about a change of the window's fullscreen state, once: a + * switch between one screen and all of them is not one. */ +- (void)reportFullscreen:(BOOL)fullscreen { + if (_fullscreenReported == fullscreen) { + return; + } + _fullscreenReported = fullscreen; + if (_running && _callbackHandle != 0) { + vivaWindowFullscreen(_callbackHandle, _window.contentView, fullscreen ? 1 : 0); + } +} + - (int)changeDecoration:(BOOL)decorated { if (!_running || !_window.isVisible || _window.isMiniaturized) { return 0; @@ -4323,16 +4407,144 @@ - (void)setWindowTitle:(NSString *)title { } } -- (void)setFullscreen:(BOOL)fullscreen { +/* One screen's native full screen is a Space of its own that AppKit animates, + * so the window goes there and back by toggleFullScreen: and the request is + * reconciled with where the window is when each transition ends. */ +- (void)applyNativeFullscreen:(BOOL)fullscreen { _fullscreenTarget = fullscreen; - if (!_fullscreenTransition && [self isFullscreen] != fullscreen) { + if (!_fullscreenTransition && [self isNativeFullscreen] != fullscreen) { _fullscreenTransition = YES; [_window toggleFullScreen:nil]; } } +/* SetFullscreen: fullscreen on one screen, or no fullscreen. Spanning the + * screens is left first, without telling OnFullscreen of it. */ +- (void)setFullscreen:(BOOL)fullscreen { + _spanPending = NO; + if (_spanning) { + [self leaveSpan]; + if (fullscreen) { + [self applyNativeFullscreen:YES]; + } else { + [self reportFullscreen:NO]; + [self reportFrameChange]; + } + return; + } + [self applyNativeFullscreen:fullscreen]; +} + +- (void)spanningWindowRequestsLeave { + [self setFullscreen:NO]; +} + +/* SetFullscreenAllMonitors(true): 1 when accepted, -1 when the screens are + * separate Spaces, where a window never covers more than one of them. With a + * single screen this is SetFullscreen(true). */ +- (int)setFullscreenAllMonitors { + if (NSScreen.screens.count < 2) { + [self setFullscreen:YES]; + return 1; + } + if (NSScreen.screensHaveSeparateSpaces) { + return -1; + } + if (_spanning) { + [_window setFrame:viva_screens_union() display:YES]; + return 1; + } + if (_fullscreenTransition || [self isNativeFullscreen]) { + /* Native full screen is left first; the window spans when that ends. */ + _spanPending = YES; + [self applyNativeFullscreen:NO]; + return 1; + } + [self enterSpan]; + return 1; +} + +/* Spanning is not AppKit's full screen: the window turns borderless, takes the + * bounding box of every screen above the menu bar, and hides the menu bar and + * the Dock. It stays on this Space, so it can cover several displays when they + * share one. Everything it changes is remembered for leaveSpan. */ +- (void)enterSpan { + if (_spanning || ![_window isKindOfClass:[VivaWorkspaceWindow class]]) { + return; + } + BOOL key = _window.isKeyWindow; + if ([_window.contentView isKindOfClass:[VivaMetalView class]]) { + [(VivaMetalView *)_window.contentView cancelTitlebarDrag]; + } + _spanFrame = _window.frame; + _spanStyle = _window.styleMask; + _spanPresentation = NSApp.presentationOptions; + _spanning = YES; + ((VivaWorkspaceWindow *)_window).spansScreens = YES; + _window.styleMask = NSWindowStyleMaskBorderless; + _window.level = NSMainMenuWindowLevel + 1; + NSApp.presentationOptions = _spanPresentation | NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar; + [_window setFrame:viva_screens_union() display:YES]; + if (key && !_window.isKeyWindow) { + [_window makeKeyWindow]; + } + /* Above the menu bar the window would also stay over other applications. */ + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationResignedActive:) + name:NSApplicationDidResignActiveNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationBecameActive:) + name:NSApplicationDidBecomeActiveNotification object:nil]; + [self reportFullscreen:YES]; +} + +/* Gives the application what spanning took from it: the menu bar and the Dock, + * and the observers that keep the window from covering other applications. */ +- (void)endSpanSession { + _spanning = NO; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationDidResignActiveNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationDidBecomeActiveNotification object:nil]; + NSApp.presentationOptions = _spanPresentation; +} + +/* Puts back the frame, style, level and presentation options enterSpan took. */ +- (void)leaveSpan { + if (!_spanning) { + return; + } + [self endSpanSession]; + if ([_window isKindOfClass:[VivaWorkspaceWindow class]]) { + ((VivaWorkspaceWindow *)_window).spansScreens = NO; + } + BOOL key = _window.isKeyWindow; + _window.styleMask = _spanStyle; + [self setAlwaysOnTop:_alwaysOnTop]; + [_window setFrame:_spanFrame display:YES]; + if (_windowMode == VIVA_WINDOW_CUSTOM_TITLEBAR) { + [self keepTrafficLightsCentered]; + } + if (key && !_window.isKeyWindow) { + [_window makeKeyWindow]; + } +} + +- (void)applicationResignedActive:(NSNotification *)notification { + (void)notification; + if (_spanning) { + _window.level = NSNormalWindowLevel; + } +} + +- (void)applicationBecameActive:(NSNotification *)notification { + (void)notification; + if (_spanning) { + _window.level = NSMainMenuWindowLevel + 1; + } +} + - (void)setAlwaysOnTop:(BOOL)enabled { _alwaysOnTop = enabled; + if (_spanning) { + return; /* leaveSpan sets the level */ + } _window.level = enabled ? NSFloatingWindowLevel : NSNormalWindowLevel; } @@ -4345,9 +4557,7 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification { _fullscreenTarget = YES; } _fullscreenTransition = YES; - if (_running && _callbackHandle != 0) { - vivaWindowFullscreen(_callbackHandle, _window.contentView, 1); - } + [self reportFullscreen:YES]; } - (void)windowWillExitFullScreen:(NSNotification *)notification { @@ -4356,15 +4566,15 @@ - (void)windowWillExitFullScreen:(NSNotification *)notification { _fullscreenTarget = NO; } _fullscreenTransition = YES; - if (_running && _callbackHandle != 0) { - vivaWindowFullscreen(_callbackHandle, _window.contentView, 0); + if (!_spanPending) { /* leaving to span is not leaving fullscreen */ + [self reportFullscreen:NO]; } } - (void)windowDidEnterFullScreen:(NSNotification *)notification { (void)notification; _fullscreenTransition = NO; - [self setFullscreen:_fullscreenTarget]; + [self applyNativeFullscreen:_fullscreenTarget]; } - (void)windowDidExitFullScreen:(NSNotification *)notification { @@ -4374,7 +4584,16 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { [self keepTrafficLightsCentered]; } [self setAlwaysOnTop:_alwaysOnTop]; - [self setFullscreen:_fullscreenTarget]; + if (_spanPending) { + _spanPending = NO; + if (NSScreen.screens.count > 1 && !NSScreen.screensHaveSeparateSpaces) { + [self enterSpan]; + } else { + [self reportFullscreen:NO]; /* the screens changed while leaving */ + } + return; + } + [self applyNativeFullscreen:_fullscreenTarget]; [self reportFrameChange]; } @@ -4382,18 +4601,20 @@ - (void)windowDidFailToEnterFullScreen:(NSWindow *)window { (void)window; _fullscreenTransition = NO; _fullscreenTarget = NO; - if (_running && _callbackHandle != 0) { - vivaWindowFullscreen(_callbackHandle, _window.contentView, 0); + if (_spanPending) { /* not fullscreen after all, so nothing to leave */ + _spanPending = NO; + [self enterSpan]; + return; } + [self reportFullscreen:NO]; } - (void)windowDidFailToExitFullScreen:(NSWindow *)window { (void)window; _fullscreenTransition = NO; _fullscreenTarget = YES; - if (_running && _callbackHandle != 0) { - vivaWindowFullscreen(_callbackHandle, _window.contentView, 1); - } + _spanPending = NO; + [self reportFullscreen:YES]; } - (void)windowWillStartLiveResize:(NSNotification *)notification { @@ -4434,6 +4655,9 @@ - (BOOL)isMiniaturized { } - (void)hideWindow { + if (_spanning) { /* a hidden window must not keep the menu bar and the Dock away */ + [self setFullscreen:NO]; + } [_window orderOut:nil]; } @@ -4448,10 +4672,10 @@ - (void)showWindow { if (_window.isMiniaturized) { [_window deminiaturize:nil]; } - [_window makeKeyAndOrderFront:nil]; if (_windowMode != VIVA_WINDOW_PANEL) { [NSApp activateIgnoringOtherApps:YES]; } + [_window makeKeyAndOrderFront:nil]; } /* A Dock reopen must let the owner reset its hidden state before showing. */ @@ -4517,7 +4741,7 @@ - (void)placeAtOrigin { /* Puts the top-left of the content area at origin, in top-left screen * coordinates. */ - (void)moveContentTo:(NSPoint)origin { - if (_window == nil || !_running) { + if (_window == nil || !_running || _spanning) { return; } CGFloat primaryHeight = NSScreen.screens.firstObject.frame.size.height; @@ -4528,7 +4752,7 @@ - (void)moveContentTo:(NSPoint)origin { /* Changes the content area while keeping its current top-left origin. */ - (void)setVivaContentSize:(NSSize)size { - if (_window == nil || !_running || _window.miniaturized || _window.zoomed || + if (_window == nil || !_running || _window.miniaturized || _window.zoomed || _spanning || (_window.styleMask & NSWindowStyleMaskFullScreen) != 0) { return; } @@ -5045,8 +5269,18 @@ void viva_application_set_window_size(void *window, double width, double height) }); } +// Hide and show both queue on the main GCD queue rather than posting +// NSEventTypeApplicationDefined to NSApp: modal AppKit tracking loops such as +// NSStatusBarButton's mouseDown tracking dequeue and drop application-defined +// events before viva_application_run can see them, while the shared main queue +// still preserves FIFO ordering between Hide and Show. void viva_application_hide_window(void *window) { - viva_post_window_event(VIVA_HIDE_EVENT, window); + if (window == NULL) { + return; + } + dispatch_async(dispatch_get_main_queue(), ^{ + [viva_find_window(window) hideWindow]; + }); } int viva_application_set_fullscreen(void *window, int fullscreen) { @@ -5068,6 +5302,53 @@ int viva_application_set_fullscreen(void *window, int fullscreen) { return found; } +/* Makes the window fullscreen over every screen: 1 when accepted, 0 when there + * is no such window, -1 for a panel, -2 when the screens are separate Spaces. */ +int viva_application_set_fullscreen_all_monitors(void *window) { + __block int found = 0; + void (^work)(void) = ^{ + VivaAppDelegate *delegate = viva_find_window(window); + if (delegate != nil && [delegate isPanel]) { + found = -1; + } else if (delegate != nil) { + int status = [delegate setFullscreenAllMonitors]; + found = status < 0 ? -2 : 1; + } + }; + if ([NSThread isMainThread]) { + work(); + } else { + dispatch_sync(dispatch_get_main_queue(), work); + } + return found; +} + +int viva_monitors(viva_monitor *out, int capacity) { + __block int count = 0; + void (^work)(void) = ^{ + NSArray *screens = NSScreen.screens; + CGFloat primaryHeight = screens.firstObject.frame.size.height; + for (NSScreen *screen in screens) { + if (count < capacity) { + NSRect frame = screen.frame; + out[count].x = frame.origin.x; + out[count].y = primaryHeight - frame.origin.y - frame.size.height; + out[count].width = frame.size.width; + out[count].height = frame.size.height; + out[count].scale = screen.backingScaleFactor; + out[count].primary = count == 0; + } + count++; + } + }; + if ([NSThread isMainThread]) { + work(); + } else { + dispatch_sync(dispatch_get_main_queue(), work); + } + return count; +} + int viva_application_set_title(void *window, const char *title) { __block int found = 0; NSString *value = [[NSString alloc] initWithUTF8String:title != NULL ? title : ""]; @@ -5129,7 +5410,12 @@ int viva_application_change_decoration(void *window, int decorated) { } void viva_application_show_window(void *window) { - viva_post_window_event(VIVA_SHOW_EVENT, window); + if (window == NULL) { + return; + } + dispatch_async(dispatch_get_main_queue(), ^{ + [viva_find_window(window) showWindow]; + }); } void viva_application_quit(void) { diff --git a/internal/platform/darwin/platform.go b/internal/platform/darwin/platform.go index b36467a85..6894a4c35 100644 --- a/internal/platform/darwin/platform.go +++ b/internal/platform/darwin/platform.go @@ -698,7 +698,7 @@ func makeNativeTextLabels(labels []TextLabel) (unsafe.Pointer, []unsafe.Pointer, if label.Width <= 0 || label.Height <= 0 || !bitmap && !texture && label.FontSize <= 0 { continue } - content, runBytes := nativeLabelText(label.Value, label.Runs) + content, runBytes := platform.ValidLabelText(label.Value, label.Runs) value := textBytes(content) if value != nil { strings = append(strings, value) @@ -954,55 +954,6 @@ func textBytes(value string) unsafe.Pointer { return C.CBytes([]byte(value)) } -// nativeLabelText returns the text a label gives the native layer, which decodes -// it as UTF-8 and fails the whole label update on a byte it cannot decode. A -// file name stored in another encoding on a remote host is such text. Each -// invalid byte becomes U+FFFD, as the platform text system substitutes it, so -// the label still draws and the rest of the window keeps updating. -// -// runBytes is the byte count of each run in the returned text, because a -// replacement changes the length of the bytes it stands for. It is nil when -// the text was already valid, and then the runs keep their own counts. -func nativeLabelText(value string, runs []gfx.TextRun) (string, []int32) { - if utf8.ValidString(value) { - return value, nil - } - // bounds holds the end of each run in value, clamped to its length, so the - // runs cover value in order and never past it. - bounds := make([]int, len(runs)) - end := 0 - for index, run := range runs { - end = min(end+int(max(run.Bytes, 0)), len(value)) - bounds[index] = end - } - ends := make([]int, len(runs)) - out := make([]byte, 0, len(value)+len(runs)) - next := 0 - for position := 0; position < len(value); { - for next < len(runs) && bounds[next] <= position { - ends[next] = len(out) - next++ - } - decoded, size := utf8.DecodeRuneInString(value[position:]) - if decoded == utf8.RuneError && size == 1 { - out = utf8.AppendRune(out, utf8.RuneError) - } else { - out = append(out, value[position:position+size]...) - } - position += size - } - for ; next < len(runs); next++ { - ends[next] = len(out) - } - counts := make([]int32, len(runs)) - previous := 0 - for index, at := range ends { - counts[index] = int32(at - previous) - previous = at - } - return string(out), counts -} - func boolInt(value bool) int { if value { return 1 diff --git a/internal/platform/darwin/status_item_darwin.go b/internal/platform/darwin/status_item_darwin.go index 3652379c5..78b54081c 100644 --- a/internal/platform/darwin/status_item_darwin.go +++ b/internal/platform/darwin/status_item_darwin.go @@ -43,7 +43,8 @@ func (application *nativeApplication) AddStatusItem(config platform.StatusItemCo pixels := C.CBytes(config.Icon.RGBA) defer C.free(pixels) hasMenu := config.Menu != nil - item.token = C.viva_status_item_create(tooltip, nativeStatusIcon(config.Icon, pixels), C.uintptr_t(item.handle), C.int(boolInt(hasMenu))) + hasClick := config.OnClick != nil + item.token = C.viva_status_item_create(tooltip, nativeStatusIcon(config.Icon, pixels), C.uintptr_t(item.handle), C.int(boolInt(hasMenu)), C.int(boolInt(hasClick))) if item.token == nil { item.handle.Delete() return nil, errors.New("darwin: failed to create the status item") diff --git a/internal/platform/darwin/status_item_darwin.h b/internal/platform/darwin/status_item_darwin.h index c978b716b..50bc155aa 100644 --- a/internal/platform/darwin/status_item_darwin.h +++ b/internal/platform/darwin/status_item_darwin.h @@ -30,7 +30,7 @@ int viva_application_update_icon(viva_status_icon icon); /* The points an icon of this many pixels is declared at: the Dock draws it at * half its pixel size. The test beside the implementation asserts it too. */ double viva_dock_icon_points(viva_status_icon icon); -void *viva_status_item_create(const char *tooltip, viva_status_icon icon, uintptr_t callback_handle, int has_menu); +void *viva_status_item_create(const char *tooltip, viva_status_icon icon, uintptr_t callback_handle, int has_menu, int has_click); int viva_status_item_set_icon(void *item, viva_status_icon icon); void viva_status_item_set_tooltip(void *item, const char *tooltip); void viva_status_item_track_hover(void *item, int enabled); diff --git a/internal/platform/darwin/status_item_darwin.m b/internal/platform/darwin/status_item_darwin.m index ee96a10a3..0d5d664ee 100644 --- a/internal/platform/darwin/status_item_darwin.m +++ b/internal/platform/darwin/status_item_darwin.m @@ -78,19 +78,23 @@ @interface VivaStatusItem : NSObject { NSMenu *_menu; NSTrackingArea *_tracking; NSString *_tooltip; + BOOL _hasClick; + BOOL _poppingMenu; } -- (instancetype)initWithTooltip:(NSString *)tooltip icon:(viva_status_icon)icon callbackHandle:(uintptr_t)callbackHandle hasMenu:(BOOL)hasMenu; +- (instancetype)initWithTooltip:(NSString *)tooltip icon:(viva_status_icon)icon callbackHandle:(uintptr_t)callbackHandle hasMenu:(BOOL)hasMenu hasClick:(BOOL)hasClick; - (BOOL)setIcon:(viva_status_icon)icon; - (void)setTooltip:(NSString *)tooltip; - (void)trackHover:(BOOL)enabled; - (void)remove; - (void)setMenuEntries:(const viva_menu_entry *)entries count:(int)count; - (void)menuChosen:(NSMenuItem *)sender; +- (BOOL)shouldPopMenuForEvent:(NSEvent *)event; +- (void)handleStatusEvent:(NSEvent *)event; @end @implementation VivaStatusItem -- (instancetype)initWithTooltip:(NSString *)tooltip icon:(viva_status_icon)icon callbackHandle:(uintptr_t)callbackHandle hasMenu:(BOOL)hasMenu { +- (instancetype)initWithTooltip:(NSString *)tooltip icon:(viva_status_icon)icon callbackHandle:(uintptr_t)callbackHandle hasMenu:(BOOL)hasMenu hasClick:(BOOL)hasClick { self = [super init]; if (self == nil) { return nil; @@ -101,6 +105,7 @@ - (instancetype)initWithTooltip:(NSString *)tooltip icon:(viva_status_icon)icon return nil; } _callbackHandle = callbackHandle; + _hasClick = hasClick; _item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain]; _item.button.image = image; [self setTooltip:tooltip]; @@ -108,6 +113,8 @@ - (instancetype)initWithTooltip:(NSString *)tooltip icon:(viva_status_icon)icon _menu = [[NSMenu alloc] initWithTitle:@""]; _menu.autoenablesItems = NO; _menu.delegate = self; + } + if (hasMenu && !hasClick) { _item.menu = _menu; } else { _item.button.target = self; @@ -234,28 +241,61 @@ - (void)menuNeedsUpdate:(NSMenu *)menu { } } +- (void)menuDidClose:(NSMenu *)menu { + if (menu == _menu && _hasClick && _item != nil) { + _item.menu = nil; + } +} + - (void)menuChosen:(NSMenuItem *)sender { if (_callbackHandle != 0) { vivaStatusItemMenuChosen(_callbackHandle, (int)sender.tag); } } -- (void)clicked:(id)sender { - (void)sender; +- (BOOL)isSecondaryEvent:(NSEvent *)event { + return event != nil && (event.type == NSEventTypeRightMouseDown || + event.type == NSEventTypeRightMouseUp || + (event.modifierFlags & NSEventModifierFlagControl) != 0); +} + +- (BOOL)shouldPopMenuForEvent:(NSEvent *)event { + return _menu != nil && [self isSecondaryEvent:event]; +} + +- (void)popUpMenu { + if (_item == nil || _menu == nil || _poppingMenu) { + return; + } + [[self retain] autorelease]; + _poppingMenu = YES; + _item.menu = _menu; + [_item.button performClick:nil]; + _poppingMenu = NO; + if (_item != nil && _hasClick) { + _item.menu = nil; + } +} + +- (void)handleStatusEvent:(NSEvent *)event { if (_callbackHandle == 0 || _item == nil) { return; } - NSEvent *event = NSApp.currentEvent; - int button = VIVA_STATUS_BUTTON_PRIMARY; - if (event.type == NSEventTypeRightMouseDown || event.type == NSEventTypeRightMouseUp || - (event.modifierFlags & NSEventModifierFlagControl) != 0) { - button = VIVA_STATUS_BUTTON_SECONDARY; + if ([self shouldPopMenuForEvent:event]) { + [self popUpMenu]; + return; } + int button = [self isSecondaryEvent:event] ? VIVA_STATUS_BUTTON_SECONDARY : VIVA_STATUS_BUTTON_PRIMARY; NSRect frame = _item.button.window.frame; int dismissed = NSProcessInfo.processInfo.systemUptime - viva_panel_dismissed_at < VIVA_PANEL_DISMISS_WINDOW; vivaStatusItemClicked(_callbackHandle, button, frame.origin.x, frame.origin.y, frame.size.width, frame.size.height, dismissed); } +- (void)clicked:(id)sender { + (void)sender; + [self handleStatusEvent:NSApp.currentEvent]; +} + @end static NSMutableArray *viva_status_items; @@ -297,10 +337,10 @@ int viva_application_set_icon(viva_status_icon icon) { return viva_application_update_icon(icon); } -void *viva_status_item_create(const char *tooltip, viva_status_icon icon, uintptr_t callback_handle, int has_menu) { +void *viva_status_item_create(const char *tooltip, viva_status_icon icon, uintptr_t callback_handle, int has_menu, int has_click) { @autoreleasepool { NSString *text = tooltip != NULL ? [NSString stringWithUTF8String:tooltip] : @""; - VivaStatusItem *item = [[VivaStatusItem alloc] initWithTooltip:text icon:icon callbackHandle:callback_handle hasMenu:has_menu != 0]; + VivaStatusItem *item = [[VivaStatusItem alloc] initWithTooltip:text icon:icon callbackHandle:callback_handle hasMenu:has_menu != 0 hasClick:has_click != 0]; if (item == nil) { return NULL; } diff --git a/internal/platform/darwin/system_darwin.h b/internal/platform/darwin/system_darwin.h index ad52cb83c..7924fb863 100644 --- a/internal/platform/darwin/system_darwin.h +++ b/internal/platform/darwin/system_darwin.h @@ -41,6 +41,15 @@ int viva_system_pasteboard_put_html(const char *pasteboard, const char *html, co int viva_system_pasteboard_html(const char *pasteboard, char **value, char **error_message); // Reads a named pasteboard's plain text the same way. int viva_system_pasteboard_text(const char *pasteboard, char **value, char **error_message); +// Writes secret text with NSPasteboardContentsCurrentHostOnly, +// org.nspasteboard.ConcealedType and org.nspasteboard.TransientType, and stores +// the resulting changeCount in *change_count; NULL is the general pasteboard. +int viva_system_pasteboard_put_sensitive_text(const char *pasteboard, const char *text, long *change_count, char **error_message); +// Clears a named pasteboard (NULL for general) only when its changeCount still +// equals change_count, setting *cleared to 1 when cleared and 0 when unchanged. +int viva_system_pasteboard_clear_if_count(const char *pasteboard, long change_count, int *cleared, char **error_message); +// Reports whether a named pasteboard currently advertises uti (1 yes, 0 no). +int viva_system_pasteboard_has_type(const char *pasteboard, const char *uti); // Shows a modal alert. It must run on the main thread; elsewhere it returns -1. int viva_system_show_fatal_error(const char *title, const char *message); int viva_system_set_cursor(uint8_t shape, char **error_message); diff --git a/internal/platform/darwin/system_darwin.m b/internal/platform/darwin/system_darwin.m index e585927c2..09879672a 100644 --- a/internal/platform/darwin/system_darwin.m +++ b/internal/platform/darwin/system_darwin.m @@ -258,6 +258,103 @@ int viva_system_set_clipboard_text(const char *text, char **error_message) { return [NSPasteboard pasteboardWithName:viva_string(name)]; } +int viva_system_pasteboard_put_sensitive_text(const char *pasteboard, const char *text, long *change_count, char **error_message) { + if (change_count == NULL) { + viva_set_error(error_message, @"clipboard change count output is missing"); + return -1; + } + *change_count = 0; + __block int status = 0; + __block long resulting_count = 0; + __block char *failure = NULL; + dispatch_block_t operation = ^{ + @autoreleasepool { + NSString *value = viva_string(text); + if (value == nil) { + failure = viva_copy_utf8(@"clipboard text is not valid UTF-8"); + status = -1; + return; + } + NSPasteboard *board = viva_pasteboard_named(pasteboard); + [board prepareForNewContentsWithOptions:NSPasteboardContentsCurrentHostOnly]; + NSData *marker = [NSData data]; + BOOL ok = [board setData:marker forType:@"org.nspasteboard.ConcealedType"] && + [board setData:marker forType:@"org.nspasteboard.TransientType"] && + [board setString:value forType:NSPasteboardTypeString]; + if (!ok) { + [board clearContents]; + failure = viva_copy_utf8(@"AppKit refused concealed clipboard text"); + status = -1; + return; + } + resulting_count = (long)board.changeCount; + } + }; + if (pasteboard == NULL) { + viva_on_main_sync(operation); + } else { + operation(); + } + if (status != 0) { + if (error_message != NULL) { + *error_message = failure; + } else { + free(failure); + } + return status; + } + *change_count = resulting_count; + return 0; +} + +int viva_system_pasteboard_clear_if_count(const char *pasteboard, long change_count, int *cleared, char **error_message) { + if (cleared == NULL) { + viva_set_error(error_message, @"clipboard clear output is missing"); + return -1; + } + *cleared = 0; + __block int did_clear = 0; + dispatch_block_t operation = ^{ + @autoreleasepool { + NSPasteboard *board = viva_pasteboard_named(pasteboard); + if ((long)board.changeCount == change_count) { + [board clearContents]; + did_clear = 1; + } + } + }; + if (pasteboard == NULL) { + viva_on_main_sync(operation); + } else { + operation(); + } + *cleared = did_clear; + return 0; +} + +int viva_system_pasteboard_has_type(const char *pasteboard, const char *uti) { + if (uti == NULL) { + return 0; + } + __block int present = 0; + dispatch_block_t operation = ^{ + @autoreleasepool { + NSString *target = viva_string(uti); + if (target == nil) { + return; + } + NSPasteboard *board = viva_pasteboard_named(pasteboard); + present = [board.types containsObject:target] ? 1 : 0; + } + }; + if (pasteboard == NULL) { + viva_on_main_sync(operation); + } else { + operation(); + } + return present; +} + // viva_system_pasteboard_put_html writes html as public.html beside alt as // public.utf8-plain-text, the pair a rich copy leaves: a reader takes whichever // flavour it knows, and a plain reader still pastes. diff --git a/internal/platform/darwin/testdata/status_item.m b/internal/platform/darwin/testdata/status_item.m index 4c34002be..c9ce46b28 100644 --- a/internal/platform/darwin/testdata/status_item.m +++ b/internal/platform/darwin/testdata/status_item.m @@ -2,6 +2,11 @@ #include "../status_item_darwin.h" +@interface NSObject (VivaStatusItemTest) +- (BOOL)shouldPopMenuForEvent:(NSEvent *)event; +- (void)handleStatusEvent:(NSEvent *)event; +@end + double viva_panel_dismissed_at = 0.0; static void (*status_remove_hook)(void *item); static void (*status_clear_hook)(void); @@ -14,9 +19,15 @@ void viva_install_status_hooks(void (*remove)(void *item), void (*clear)(void)) static int last_chosen_id = 0; static int update_menu_called = 0; static void *update_menu_item = NULL; +static int clicked_count = 0; +static uintptr_t last_clicked_handle = 0; +static int last_clicked_button = 0; void vivaStatusItemClicked(uintptr_t callbackHandle, int button, float x, float y, float width, float height, int panelDismissed) { - (void)callbackHandle; (void)button; (void)x; (void)y; (void)width; (void)height; (void)panelDismissed; + (void)x; (void)y; (void)width; (void)height; (void)panelDismissed; + clicked_count++; + last_clicked_handle = callbackHandle; + last_clicked_button = button; } void vivaStatusItemHovered(uintptr_t callbackHandle, int entered, float x, float y, float width, float height) { @@ -91,8 +102,8 @@ int main(void) { [NSApp setApplicationIconImage:originalIcon]; [originalIcon release]; - // 1. Create status item with Menu - void *item = viva_status_item_create("Test Tooltip", icon, 1234, 1); + // 1. Create status item with Menu only + void *item = viva_status_item_create("Test Tooltip", icon, 1234, 1, 0); check(item != NULL, "item created"); update_menu_item = item; @@ -153,14 +164,81 @@ int main(void) { check(menu.numberOfItems == 0, "an empty update clears the menu"); // 7. Create status item without Menu (OnClick only) - void *clickItem = viva_status_item_create("Click Item", icon, 5678, 0); + void *clickItem = viva_status_item_create("Click Item", icon, 5678, 0, 1); check(clickItem != NULL, "clickItem created"); NSStatusItem *clickStatusItem = [(id)clickItem valueForKey:@"_item"]; check(clickStatusItem != nil, "clickStatusItem exists"); check(clickStatusItem.menu == nil, "clickStatusItem has no menu"); check(clickStatusItem.button.target == (id)clickItem, "button target is clickItem"); - // 8. Clean up + // 8. Create status item with both OnClick and Menu: primary single/double clicks + // invoke OnClick while secondary clicks open the context menu. + void *hybridItem = viva_status_item_create("Hybrid Item", icon, 9012, 1, 1); + check(hybridItem != NULL, "hybridItem created"); + NSStatusItem *hybridStatusItem = [(id)hybridItem valueForKey:@"_item"]; + NSMenu *hybridMenu = [(id)hybridItem valueForKey:@"_menu"]; + check(hybridStatusItem != nil, "hybridStatusItem exists"); + check(hybridStatusItem.menu == nil, "hybridStatusItem keeps menu detached for primary clicks"); + check(hybridMenu != nil, "hybridItem still owns context menu"); + check(hybridStatusItem.button.target == (id)hybridItem, "hybrid button target is hybridItem"); + + NSEvent *leftSingle = [NSEvent mouseEventWithType:NSEventTypeLeftMouseDown + location:NSZeroPoint + modifierFlags:0 + timestamp:1.0 + windowNumber:0 + context:nil + eventNumber:1 + clickCount:1 + pressure:1.0]; + NSEvent *leftDouble = [NSEvent mouseEventWithType:NSEventTypeLeftMouseDown + location:NSZeroPoint + modifierFlags:0 + timestamp:1.1 + windowNumber:0 + context:nil + eventNumber:2 + clickCount:2 + pressure:1.0]; + NSEvent *rightClick = [NSEvent mouseEventWithType:NSEventTypeRightMouseDown + location:NSZeroPoint + modifierFlags:0 + timestamp:1.2 + windowNumber:0 + context:nil + eventNumber:3 + clickCount:1 + pressure:1.0]; + NSEvent *ctrlLeftClick = [NSEvent mouseEventWithType:NSEventTypeLeftMouseDown + location:NSZeroPoint + modifierFlags:NSEventModifierFlagControl + timestamp:1.3 + windowNumber:0 + context:nil + eventNumber:4 + clickCount:1 + pressure:1.0]; + + clicked_count = 0; + [(id)hybridItem handleStatusEvent:leftSingle]; + check(clicked_count == 1 && last_clicked_handle == 9012 && last_clicked_button == 1, + "hybrid primary single click triggers OnClick"); + [(id)hybridItem handleStatusEvent:leftDouble]; + check(clicked_count == 2 && last_clicked_handle == 9012 && last_clicked_button == 1, + "hybrid primary double click triggers OnClick"); + check([(id)hybridItem shouldPopMenuForEvent:rightClick], + "hybrid right click routes to context menu"); + check([(id)hybridItem shouldPopMenuForEvent:ctrlLeftClick], + "hybrid Ctrl+left click routes to context menu"); + check(![(id)hybridItem shouldPopMenuForEvent:leftSingle], + "hybrid left click does not route to context menu"); + + // Closing the popped menu detaches it again so subsequent left clicks stay direct. + hybridStatusItem.menu = hybridMenu; + [hybridMenu.delegate menuDidClose:hybridMenu]; + check(hybridStatusItem.menu == nil, "menuDidClose detaches menu in hybrid mode"); + + // 9. Clean up if (status_clear_hook) { status_clear_hook(); } diff --git a/internal/platform/darwin/testdata/tentative_bridge_darwin.go b/internal/platform/darwin/testdata/tentative_bridge_darwin.go index 4ca43a516..b6214c424 100644 --- a/internal/platform/darwin/testdata/tentative_bridge_darwin.go +++ b/internal/platform/darwin/testdata/tentative_bridge_darwin.go @@ -96,6 +96,9 @@ static void tentative_select(void *view, unsigned long start, unsigned long leng static void tentative_command(void *view) { ((void (*)(id, SEL, SEL))objc_msgSend)((id)view, sel_registerName("doCommandBySelector:"), sel_registerName("moveWordLeft:")); } +static void tentative_named_command(void *view, const char *name) { + ((void (*)(id, SEL, SEL))objc_msgSend)((id)view, sel_registerName("doCommandBySelector:"), sel_registerName(name)); +} static void tentative_resign(void *view) { ((BOOL (*)(id, SEL))objc_msgSend)((id)view, sel_registerName("resignFirstResponder")); } @@ -168,8 +171,13 @@ func tentativeBridgeSelect(view unsafe.Pointer, start, length int) { C.tentative_select(view, C.ulong(start), C.ulong(length)) } func tentativeBridgeCommand(view unsafe.Pointer) { C.tentative_command(view) } -func tentativeBridgeResign(view unsafe.Pointer) { C.tentative_resign(view) } -func tentativeBridgeDetach(view unsafe.Pointer) { C.tentative_detach(view) } +func tentativeBridgeNamedCommand(view unsafe.Pointer, selector string) { + name := C.CString(selector) + defer C.free(unsafe.Pointer(name)) + C.tentative_named_command(view, name) +} +func tentativeBridgeResign(view unsafe.Pointer) { C.tentative_resign(view) } +func tentativeBridgeDetach(view unsafe.Pointer) { C.tentative_detach(view) } func tentativeBridgeUnmarkOnDiscard(enabled bool) { C.tentative_unmark_on_discard(C.int(boolInt(enabled))) } diff --git a/internal/platform/darwin/testdata/tentative_bridge_darwin_test.go b/internal/platform/darwin/testdata/tentative_bridge_darwin_test.go index 0ffb57ff8..a68cd7a69 100644 --- a/internal/platform/darwin/testdata/tentative_bridge_darwin_test.go +++ b/internal/platform/darwin/testdata/tentative_bridge_darwin_test.go @@ -193,6 +193,35 @@ func TestDarwinTentativeProbeLegacyAndOrdinaryInput(t *testing.T) { } } +// An input method that clears its marked text (Backspace over the last letter, +// or Command+Delete in some) sends an empty mark and nothing else: AppKit has no +// other end of composition. The view must stop reporting marked text, or the +// input method keeps taking the next keys for a composition that is gone. +func TestDarwinTentativeProbeEmptiedMarkEndsTheComposition(t *testing.T) { + for _, enabled := range []bool{false, true} { + name := "legacy" + if enabled { + name = "tentative" + } + t.Run(name, func(t *testing.T) { + probe := newTentativeBridgeProbe(t, "这个软件真不错", enabled) + tentativeBridgeMark(probe.view, "zhen'bu'cuo", 11, 0, 0, 0, false) + if !tentativeBridgeMarked(probe.view) { + t.Fatal("setup: the mark did not start a composition") + } + tentativeBridgeMark(probe.view, "", 0, 0, 0, 0, false) + probe.assertState(t, "这个软件真不错") + if _, composing := probe.editor.Composition(); composing || tentativeBridgeMarked(probe.view) { + t.Fatalf("composing=%v native marked=%v after the input method cleared its text", composing, tentativeBridgeMarked(probe.view)) + } + tentativeBridgeNamedCommand(probe.view, "deleteBackward:") + probe.assertState(t, "这个软件真不") + tentativeBridgeNamedCommand(probe.view, "deleteToBeginningOfLine:") + probe.assertState(t, "") + }) + } +} + func TestDarwinTentativeProbePresentationRefreshKeepsContext(t *testing.T) { probe := newTentativeBridgeProbe(t, "abc", true) tentativeBridgeMark(probe.view, "x", 1, 0, 0, 0, false) diff --git a/internal/platform/darwin/testdata/text_selection.m b/internal/platform/darwin/testdata/text_selection.m index 72b34cfa8..dd769ff83 100644 --- a/internal/platform/darwin/testdata/text_selection.m +++ b/internal/platform/darwin/testdata/text_selection.m @@ -916,10 +916,10 @@ int main(void) { [view beginComposition]; view->fakeMarkedMode = 7; [view keyDown:escape]; - assert(view->editEvents == edits + 2); + // The emptied mark still left a composition, so it is committed. + assert(view->editEvents == edits + 3); assert(view->cancelEvents == cancels); - assert(view->lastKind == VIVA_TEXT_SET_MARKED); - assert([view->lastText length] == 0); + assert(view->lastKind == VIVA_TEXT_UNMARK); edits = view->editEvents; cancels = view->cancelEvents; @@ -943,10 +943,9 @@ int main(void) { [view beginComposition]; view->fakeMarkedMode = 6; [view keyDown:escape]; - assert(view->editEvents == edits + 2); + assert(view->editEvents == edits + 3); assert(view->cancelEvents == cancels + 1); - assert(view->lastKind == VIVA_TEXT_SET_MARKED); - assert([view->lastText length] == 0); + assert(view->lastKind == VIVA_TEXT_UNMARK); edits = view->editEvents; cancels = view->cancelEvents; @@ -988,14 +987,23 @@ int main(void) { // Outside an Escape interpretation an empty mark and an empty insert // stay ordinary text events rather than being inferred as cancellation. + // An empty mark that leaves a composition open commits it: AppKit has + // no other end, and an open one would keep the input method's keys. edits = view->editEvents; cancels = view->cancelEvents; view->fakeMarkedMode = 0; [view beginComposition]; [view setMarkedText:@"" selectedRange:NSMakeRange(0, 0) replacementRange:NSMakeRange(NSNotFound, 0)]; - assert(view->editEvents == edits + 1); + assert(view->editEvents == edits + 2); assert(view->cancelEvents == cancels); + assert(view->lastKind == VIVA_TEXT_UNMARK); + // With nothing marked an empty mark is only the text event. + edits = view->editEvents; + [view endComposition]; + [view setMarkedText:@"" selectedRange:NSMakeRange(0, 0) replacementRange:NSMakeRange(NSNotFound, 0)]; + assert(view->editEvents == edits + 1); assert(view->lastKind == VIVA_TEXT_SET_MARKED); + [view beginComposition]; [view insertText:@"" replacementRange:NSMakeRange(NSNotFound, 0)]; assert(view->editEvents == edits + 2); assert(view->cancelEvents == cancels); diff --git a/internal/platform/darwin/testdata/window_opacity.m b/internal/platform/darwin/testdata/window_opacity.m new file mode 100644 index 000000000..9bd50bfe9 --- /dev/null +++ b/internal/platform/darwin/testdata/window_opacity.m @@ -0,0 +1,77 @@ +#include "../core_text.m" +#include "../core_render.m" +#include "../watermark_darwin.m" +#include "../native.m" +#include "../main_menu_darwin.m" +#include + +void vivaPointerEvent(uintptr_t handle, void *view, int kind, int button, int modifiers, int clickCount, double x, double y, double screenX, double screenY) {} +#include "window_test_callbacks.h" + +@interface OpacityBackground : NSView +@end + +@implementation OpacityBackground +- (BOOL)isOpaque { return YES; } +@end + +static VivaMetalView *makeView(int mode, double alpha) { + return [[VivaMetalView alloc] + initWithFrame:NSMakeRect(0, 0, 160, 100) + device:nil commandQueue:nil rectanglePipeline:nil rectangleBuffer:nil + rectangleCount:0 rectangleClips:NULL textPipeline:nil textLabels:NULL + textLabelCount:0 accessibility:NULL accessibilityCount:0 + textInput:(viva_text_input_config){0} + dynamicTextInputEnabled:NO pointerEventsEnabled:NO resizeEventsEnabled:NO + keyEventsEnabled:NO scrollEventsEnabled:NO windowMode:mode callbackHandle:0 + clearColor:MTLClearColorMake(0, 0, 0, alpha)]; +} + +static void check(int mode, double alpha) { + OpacityBackground *background = [[OpacityBackground alloc] initWithFrame:NSMakeRect(0, 0, 160, 100)]; + VivaMetalView *view = makeView(mode, alpha); + assert(view != nil); + [background addSubview:view]; + BOOL expected = alpha >= 1 && mode != VIVA_WINDOW_PANEL && + mode != VIVA_WINDOW_PREVIEW && mode != VIVA_WINDOW_NOTIFICATION; + if (view.isOpaque != expected || view.opaqueAncestor != (expected ? view : background)) { + fprintf(stderr, "mode=%d alpha=%.2f viewOpaque=%d layerOpaque=%d selfOpaqueAncestor=%d expected=%d\n", + mode, alpha, view.isOpaque, view.layer.isOpaque, view.opaqueAncestor == view, expected); + abort(); + } + [view removeFromSuperview]; + [view release]; + [background release]; +} + +int main(int argc, const char *argv[]) { + @autoreleasepool { + [NSApplication sharedApplication]; + [NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited]; + const int modes[] = { + VIVA_WINDOW_TITLED, VIVA_WINDOW_CUSTOM_TITLEBAR, VIVA_WINDOW_FRAMELESS, + VIVA_WINDOW_PANEL, VIVA_WINDOW_PREVIEW, VIVA_WINDOW_NOTIFICATION + }; + const double alphas[] = {0, 0.35, 1}; + for (size_t mode = 0; mode < sizeof(modes) / sizeof(modes[0]); mode++) { + for (size_t alpha = 0; alpha < sizeof(alphas) / sizeof(alphas[0]); alpha++) { + check(modes[mode], alphas[alpha]); + } + } + if (argc == 2 && strcmp(argv[1], "--benchmark") == 0) { + VivaMetalView *view = makeView(VIVA_WINDOW_CUSTOM_TITLEBAR, 0.35); + const NSUInteger iterations = 1000000; + volatile NSUInteger opaqueCount = 0; + uint64_t start = mach_continuous_time(); + for (NSUInteger index = 0; index < iterations; index++) { + opaqueCount += view.isOpaque; + } + double elapsed = viva_elapsed_milliseconds(start, mach_continuous_time()); + assert(opaqueCount == 0); + printf("%.3f ns/query\n", elapsed * 1000000 / iterations); + [view release]; + } + puts("PASS: transparent views preserve the opaque ancestor behind them"); + } + return 0; +} diff --git a/internal/platform/darwin/window_monitors_darwin.go b/internal/platform/darwin/window_monitors_darwin.go new file mode 100644 index 000000000..14998621e --- /dev/null +++ b/internal/platform/darwin/window_monitors_darwin.go @@ -0,0 +1,111 @@ +//go:build !ios + +package darwin + +/* +#include "native.h" +*/ +import "C" + +import ( + "fmt" + "math" + "slices" + + "github.com/vivaui/viva/internal/platform" +) + +// cocoaScreen is one NSScreen in points, already moved to the origin at the +// top-left of the primary screen with y growing downward (what viva_monitors +// reports), with the screen's pixels per point. +type cocoaScreen struct { + X, Y, Width, Height float64 + Scale float64 + Primary bool +} + +// monitorsFromScreens turns screens in points into platform monitors in device +// pixels: every coordinate is multiplied by the screen's own scale. The primary +// monitor comes first, then the others left to right and top to bottom. +func monitorsFromScreens(screens []cocoaScreen) []platform.Monitor { + monitors := make([]platform.Monitor, len(screens)) + for index, screen := range screens { + scale := screen.Scale + if scale <= 0 { + scale = 1 + } + monitors[index] = platform.Monitor{ + X: int(math.Round(screen.X * scale)), + Y: int(math.Round(screen.Y * scale)), + Width: int(math.Round(screen.Width * scale)), + Height: int(math.Round(screen.Height * scale)), + Scale: float32(scale), + Primary: screen.Primary, + } + } + slices.SortStableFunc(monitors, func(a, b platform.Monitor) int { + switch { + case a.Primary != b.Primary: + if a.Primary { + return -1 + } + return 1 + case a.X != b.X: + return a.X - b.X + default: + return a.Y - b.Y + } + }) + return monitors +} + +// Monitors lists the displays from NSScreen, which AppKit only answers on the +// main thread: off it the call waits for that thread. Safe from any goroutine. +func (window *nativeWindow) Monitors() ([]platform.Monitor, error) { + if window == nil || window.closed.Load() { + return nil, fmt.Errorf("darwin: window is closed") + } + return listMonitors(), nil +} + +func listMonitors() []platform.Monitor { + var buffer [8]C.viva_monitor + count := int(C.viva_monitors(&buffer[0], C.int(len(buffer)))) + listed := buffer[:min(count, len(buffer))] + if count > len(buffer) { + listed = make([]C.viva_monitor, count) + count = int(C.viva_monitors(&listed[0], C.int(len(listed)))) + listed = listed[:min(count, len(listed))] + } + screens := make([]cocoaScreen, len(listed)) + for index, monitor := range listed { + screens[index] = cocoaScreen{ + X: float64(monitor.x), Y: float64(monitor.y), + Width: float64(monitor.width), Height: float64(monitor.height), + Scale: float64(monitor.scale), Primary: monitor.primary != 0, + } + } + return monitorsFromScreens(screens) +} + +// SetFullscreenAllMonitors covers the bounding box of every display with the +// window, or with false leaves fullscreen as SetFullscreen(false) does. With one +// display it is SetFullscreen(true). A window cannot cross displays while +// System Settings > Desktop & Dock > "Displays have separate Spaces" is on, so +// then it returns platform.ErrFullscreenAllMonitorsUnsupported and leaves the +// window as it was. +func (window *nativeWindow) SetFullscreenAllMonitors(fullscreen bool) error { + if !fullscreen { + return window.SetFullscreen(false) + } + if window == nil || window.closed.Load() { + return fmt.Errorf("darwin: window is closed") + } + switch C.viva_application_set_fullscreen_all_monitors(window.token) { + case -1, -2: + return platform.ErrFullscreenAllMonitorsUnsupported + case 0: + return fmt.Errorf("darwin: fullscreen window is unavailable") + } + return nil +} diff --git a/internal/platform/darwin/window_monitors_darwin_test.go b/internal/platform/darwin/window_monitors_darwin_test.go new file mode 100644 index 000000000..3d7e1c5f7 --- /dev/null +++ b/internal/platform/darwin/window_monitors_darwin_test.go @@ -0,0 +1,58 @@ +//go:build darwin && !ios + +package darwin + +import "testing" + +func TestMonitorsFromScreensOrdersAndConverts(t *testing.T) { + monitors := monitorsFromScreens([]cocoaScreen{ + {X: 1440, Y: -200, Width: 1920, Height: 1080, Scale: 1}, + {X: -1280, Y: 0, Width: 1280, Height: 720, Scale: 1}, + {X: 0, Y: 0, Width: 1440, Height: 900, Scale: 2, Primary: true}, + {X: 0, Y: -720, Width: 1280, Height: 720, Scale: 1}, + }) + if len(monitors) != 4 { + t.Fatalf("monitors = %d, want 4", len(monitors)) + } + if !monitors[0].Primary || monitors[0].X != 0 || monitors[0].Y != 0 { + t.Fatalf("first monitor = %+v, want the primary at the origin", monitors[0]) + } + if monitors[0].Width != 2880 || monitors[0].Height != 1800 || monitors[0].Scale != 2 { + t.Fatalf("primary = %+v, want device pixels of a 2x display", monitors[0]) + } + for index := 1; index < len(monitors); index++ { + if monitors[index].Primary { + t.Fatalf("monitor %d is also primary", index) + } + } + for index := 2; index < len(monitors); index++ { + previous, current := monitors[index-1], monitors[index] + if previous.X > current.X || previous.X == current.X && previous.Y > current.Y { + t.Fatalf("monitors %d and %d are out of left-to-right, top-to-bottom order: %+v %+v", index-1, index, previous, current) + } + } +} + +func TestMonitorsFromScreensNeverScalesByZero(t *testing.T) { + monitors := monitorsFromScreens([]cocoaScreen{{Width: 800, Height: 600, Primary: true}}) + if len(monitors) != 1 || monitors[0].Width != 800 || monitors[0].Height != 600 || monitors[0].Scale != 1 { + t.Fatalf("monitors = %+v, want one 800x600 display at scale 1", monitors) + } +} + +// NSScreen is only asked on the main thread, which the test main serves; no +// window is opened. +func TestListMonitorsDescribesTheDesktop(t *testing.T) { + monitors := listMonitors() + if len(monitors) == 0 { + t.Skip("no display is attached") + } + if !monitors[0].Primary || monitors[0].X != 0 || monitors[0].Y != 0 { + t.Fatalf("first monitor = %+v, want the primary at the origin", monitors[0]) + } + for _, monitor := range monitors { + if monitor.Width <= 0 || monitor.Height <= 0 || monitor.Scale <= 0 { + t.Fatalf("monitor %+v has no size or scale", monitor) + } + } +} diff --git a/internal/platform/darwin/window_opacity_darwin_test.go b/internal/platform/darwin/window_opacity_darwin_test.go new file mode 100644 index 000000000..944c3bd4b --- /dev/null +++ b/internal/platform/darwin/window_opacity_darwin_test.go @@ -0,0 +1,50 @@ +//go:build !ios + +package darwin + +import ( + "os/exec" + "path/filepath" + "strconv" + "strings" + "testing" +) + +func TestNativeWindowOpacityPreservesBackgroundRedraw(t *testing.T) { + executable := compileWindowOpacityFixture(t) + if output, err := exec.Command(executable).CombinedOutput(); err != nil { + t.Fatalf("native window opacity: %v\n%s", err, output) + } +} + +func BenchmarkNativeWindowOpacity(b *testing.B) { + executable := compileWindowOpacityFixture(b) + b.ResetTimer() + for b.Loop() { + output, err := exec.Command(executable, "--benchmark").CombinedOutput() + if err != nil { + b.Fatalf("native window opacity benchmark: %v\n%s", err, output) + } + fields := strings.Fields(string(output)) + if len(fields) < 2 || fields[1] != "ns/query" { + b.Fatalf("missing native opacity timing: %s", output) + } + elapsed, err := strconv.ParseFloat(fields[0], 64) + if err != nil { + b.Fatalf("parse native opacity timing: %v\n%s", err, output) + } + b.ReportMetric(elapsed, "ns/query") + } +} + +func compileWindowOpacityFixture(t testing.TB) string { + t.Helper() + executable := filepath.Join(t.TempDir(), "window-opacity") + command := exec.Command("xcrun", "clang", "-fno-objc-arc", "-Werror", + "-Wno-deprecated-declarations", "testdata/window_opacity.m", "-o", executable, + "-framework", "Cocoa", "-framework", "CoreText", "-framework", "Metal", "-framework", "QuartzCore") + if output, err := command.CombinedOutput(); err != nil { + t.Fatalf("compile native window opacity fixture: %v\n%s", err, output) + } + return executable +} diff --git a/internal/platform/linux/always_on_top_linux.go b/internal/platform/linux/always_on_top_linux.go index 74823dba6..8bfc55c5f 100644 --- a/internal/platform/linux/always_on_top_linux.go +++ b/internal/platform/linux/always_on_top_linux.go @@ -23,7 +23,7 @@ func (window *nativeWindow) SetAlwaysOnTop(enabled bool) error { if win.connection == 0 { return fmt.Errorf("linux: window is closed") } - supported, err := win.supportsAbove() + supported, err := win.supportsHint(win.frame.above) if err != nil { return err } diff --git a/internal/platform/linux/clipboard_files_write_linux.go b/internal/platform/linux/clipboard_files_write_linux.go index 4ebb8585a..0797403c8 100644 --- a/internal/platform/linux/clipboard_files_write_linux.go +++ b/internal/platform/linux/clipboard_files_write_linux.go @@ -70,5 +70,7 @@ func (win *window) claimClipboardLocked() error { if owner != win.id { return fmt.Errorf("linux: X server refused clipboard ownership") } + win.clipboardGeneration++ + win.clipboardSecret = false return nil } diff --git a/internal/platform/linux/clipboard_sensitive_linux_test.go b/internal/platform/linux/clipboard_sensitive_linux_test.go new file mode 100644 index 000000000..9fb880eb5 --- /dev/null +++ b/internal/platform/linux/clipboard_sensitive_linux_test.go @@ -0,0 +1,147 @@ +//go:build !android + +package linux + +import ( + "slices" + "testing" + "unsafe" +) + +func TestSensitiveClipboardAdvertisesPasswordManagerHintSkipsManagerAndClearsByGeneration(t *testing.T) { + recorder := &selectionRecorder{masks: map[uint32]uint32{}, incrAtom: 77} + currentOwner := uint32(2) + api := recorder.api() + api.selectionOwnerReply = func(uintptr, xcbSelectionOwnerCookie, *unsafe.Pointer) *xcbSelectionOwnerReply { + return &xcbSelectionOwnerReply{Owner: currentOwner} + } + converted := 0 + api.convertSelection = func(uintptr, uint32, uint32, uint32, uint32, uint32) xcbVoidCookie { + converted++ + return xcbVoidCookie{} + } + + win := &window{ + api: api, connection: 1, id: 2, + clipboardAtom: 10, utf8Atom: 11, textAtom: 12, targetsAtom: 13, + uriListAtom: 15, gnomeFilesAtom: 16, htmlAtom: 17, pngAtom: 18, passwordHintAtom: 19, + } + previousWindow, previousHooks := activeWindow.Load(), shellHooks.Load() + activeWindow.Store(win) + shellHooks.Store(nil) + t.Cleanup(func() { + activeWindow.Store(previousWindow) + shellHooks.Store(previousHooks) + }) + + clearFn, err := SetSensitiveClipboardText("s3cret-linux-中") + if err != nil { + t.Fatal(err) + } + if !win.ownsClipboard || !win.clipboardSecret || win.clipboard != "s3cret-linux-中" { + t.Fatalf("window clipboard state: owned=%v secret=%v text=%q", win.ownsClipboard, win.clipboardSecret, win.clipboard) + } + + request := func(target uint32) propertyWrite { + t.Helper() + before := len(recorder.writes) + if err := win.handleSelectionRequest(&xcbSelectionRequestEvent{Requestor: 3, Selection: 10, Target: target, Property: 14}); err != nil { + t.Fatal(err) + } + if len(recorder.writes) != before+1 { + t.Fatalf("target %d produced %d writes, want 1", target, len(recorder.writes)-before) + } + return recorder.writes[before] + } + + targetsWrite := request(win.targetsAtom) + var offered []uint32 + for offset := 0; offset+4 <= len(targetsWrite.data); offset += 4 { + offered = append(offered, uint32(targetsWrite.data[offset])|uint32(targetsWrite.data[offset+1])<<8|uint32(targetsWrite.data[offset+2])<<16|uint32(targetsWrite.data[offset+3])<<24) + } + if !slices.Contains(offered, win.passwordHintAtom) { + t.Fatalf("TARGETS = %v, want passwordHintAtom %d included", offered, win.passwordHintAtom) + } + hintWrite := request(win.passwordHintAtom) + if hintWrite.kind != win.passwordHintAtom || string(hintWrite.data) != "secret" { + t.Fatalf("x-kde-passwordManagerHint = kind %d data %q, want %d / \"secret\"", hintWrite.kind, hintWrite.data, win.passwordHintAtom) + } + if utf8Write := request(win.utf8Atom); string(utf8Write.data) != "s3cret-linux-中" { + t.Fatalf("UTF8_STRING = %q", utf8Write.data) + } + + // Closing a window holding a sensitive secret must not hand it to CLIPBOARD_MANAGER. + win.saveClipboardToManager() + if converted != 0 { + t.Fatalf("saveClipboardToManager converted %d selections for a secret clipboard, want 0", converted) + } + + // Unchanged ownership and generation: clear releases CLIPBOARD and reports true. + recorder.ownerCalls = nil + cleared, err := clearFn() + if err != nil || !cleared { + t.Fatalf("clear unchanged: cleared=%v err=%v, want true, nil", cleared, err) + } + if win.ownsClipboard || win.clipboardSecret || win.clipboard != "" { + t.Fatalf("after clear: owned=%v secret=%v text=%q", win.ownsClipboard, win.clipboardSecret, win.clipboard) + } + if len(recorder.ownerCalls) != 1 || recorder.ownerCalls[0] != [2]uint32{xcbAtomNone, win.clipboardAtom} { + t.Fatalf("owner calls on clear = %v, want release to xcbAtomNone", recorder.ownerCalls) + } + + // Replaced by a plain copy in the same window: hint disappears and stale clear does nothing. + clearFn2, err := SetSensitiveClipboardText("ephemeral-1") + if err != nil { + t.Fatal(err) + } + if err := SetClipboardText("plain text"); err != nil { + t.Fatal(err) + } + if win.clipboardSecret { + t.Fatal("SetClipboardText left clipboardSecret set") + } + targetsWrite = request(win.targetsAtom) + offered = nil + for offset := 0; offset+4 <= len(targetsWrite.data); offset += 4 { + offered = append(offered, uint32(targetsWrite.data[offset])|uint32(targetsWrite.data[offset+1])<<8|uint32(targetsWrite.data[offset+2])<<16|uint32(targetsWrite.data[offset+3])<<24) + } + if slices.Contains(offered, win.passwordHintAtom) { + t.Fatalf("TARGETS still advertises x-kde-passwordManagerHint after plain copy: %v", offered) + } + cleared, err = clearFn2() + if err != nil || cleared || win.clipboard != "plain text" || !win.ownsClipboard { + t.Fatalf("stale clear after plain copy: cleared=%v err=%v text=%q owned=%v", cleared, err, win.clipboard, win.ownsClipboard) + } + + // Replaced by another X11 client taking CLIPBOARD ownership: clear reports false without reclaiming/releasing. + clearFn3, err := SetSensitiveClipboardText("ephemeral-2") + if err != nil { + t.Fatal(err) + } + currentOwner = 99 + recorder.ownerCalls = nil + cleared, err = clearFn3() + if err != nil || cleared || len(recorder.ownerCalls) != 0 { + t.Fatalf("clear after external owner: cleared=%v err=%v ownerCalls=%v", cleared, err, recorder.ownerCalls) + } +} + +func TestSetSensitiveClipboardTextRejectsInvalidInputBeforeClaiming(t *testing.T) { + previous := shellHooks.Load() + t.Cleanup(func() { shellHooks.Store(previous) }) + calls := 0 + shellHooks.Store(&desktopHooks{ + setSensitiveClipboardText: func(string) (func() (bool, error), error) { + calls++ + return func() (bool, error) { return true, nil }, nil + }, + }) + for _, bad := range []string{"", "a\x00b", "bad\xff"} { + if _, err := SetSensitiveClipboardText(bad); err == nil { + t.Fatalf("SetSensitiveClipboardText(%q) succeeded, want error", bad) + } + } + if calls != 0 { + t.Fatalf("invalid inputs invoked desktop hook %d times, want 0", calls) + } +} diff --git a/internal/platform/linux/clipboard_sensitive_write_linux.go b/internal/platform/linux/clipboard_sensitive_write_linux.go new file mode 100644 index 000000000..32d7f4b33 --- /dev/null +++ b/internal/platform/linux/clipboard_sensitive_write_linux.go @@ -0,0 +1,85 @@ +//go:build !android + +package linux + +import ( + "fmt" + "strings" + "unicode/utf8" +) + +// SupportsSensitiveClipboard reports whether SetSensitiveClipboardText can mark +// its copy under the running shell. The XCB backend always can; a shell that +// owns the clipboard (GTK) can only if it provides the write. +func SupportsSensitiveClipboard() bool { + hooks := shellHooks.Load() + return hooks == nil || hooks.setSensitiveClipboardText != nil +} + +// SetSensitiveClipboardText claims CLIPBOARD with value alongside the +// x-kde-passwordManagerHint ("secret") target so clipboard managers do not +// record it, suppresses CLIPBOARD_MANAGER hand-off on window close, and returns +// clear, which releases CLIPBOARD only if this window still owns that exact +// write generation. +// +// The text is held as a Go string in the window's clipboard state and in the +// caller's own copy, neither of which can be wiped; clear drops the reference +// and leaves reclamation to the garbage collector. Erasing it would mean a +// []byte clipboard model threaded through every clipboard write and the +// selection-serving path, which would still not reach the caller's string. +func SetSensitiveClipboardText(value string) (func() (bool, error), error) { + if value == "" { + return nil, fmt.Errorf("linux: sensitive clipboard text is empty") + } + if len(value) > maxClipboardBytes { + return nil, fmt.Errorf("linux: clipboard text exceeds 64 MiB") + } + if strings.IndexByte(value, 0) >= 0 { + return nil, fmt.Errorf("linux: clipboard text contains NUL") + } + if !utf8.ValidString(value) { + return nil, fmt.Errorf("linux: clipboard text is not valid UTF-8") + } + if hooks := shellHooks.Load(); hooks != nil { + if hooks.setSensitiveClipboardText == nil { + return nil, ErrUnsupported + } + return hooks.setSensitiveClipboardText(value) + } + win := activeWindow.Load() + if win == nil { + return nil, fmt.Errorf("linux: clipboard ownership requires a running window") + } + win.mu.Lock() + defer win.mu.Unlock() + if activeWindow.Load() != win || win.connection == 0 { + return nil, fmt.Errorf("linux: clipboard ownership requires a running window") + } + if err := win.claimClipboardLocked(); err != nil { + return nil, err + } + win.clipboard = value + win.clipboardSecret = true + win.clipboardHTML = "" + win.clipboardFiles = nil + win.clipboardImage = nil + win.ownsClipboard = true + generation := win.clipboardGeneration + + return func() (bool, error) { + win.mu.Lock() + defer win.mu.Unlock() + if win.connection == 0 || win.clipboardGeneration != generation || !win.clipboardOwnedLocked() { + return false, nil + } + win.api.setSelectionOwner(win.connection, xcbAtomNone, win.clipboardAtom, 0) + win.clipboard, win.clipboardHTML, win.clipboardFiles, win.clipboardImage = "", "", nil, nil + win.clipboardSecret = false + win.ownsClipboard = false + win.clipboardGeneration++ + if win.api.flush(win.connection) <= 0 || win.api.connectionHasError(win.connection) != 0 { + return false, fmt.Errorf("linux: release clipboard: XCB connection failed") + } + return true, nil + }, nil +} diff --git a/internal/platform/linux/fullscreen_linux.go b/internal/platform/linux/fullscreen_linux.go index ebbccfbf0..0a4365055 100644 --- a/internal/platform/linux/fullscreen_linux.go +++ b/internal/platform/linux/fullscreen_linux.go @@ -2,7 +2,28 @@ package linux -import "fmt" +import ( + "fmt" + + "github.com/vivaui/viva/internal/platform" +) + +// Fullscreen on X11 is _NET_WM_STATE_FULLSCREEN, which the window manager +// answers with one monitor. Across all monitors the window also says which +// monitors the picture is to cover: _NET_WM_FULLSCREEN_MONITORS names the +// monitors whose edges are the top, bottom, left and right of the bounding box +// of the area (EWMH), and the window manager sizes the window to it. The same +// message with one index four times goes back to one monitor, so a switch +// between the two never leaves the fullscreen state: the state change is +// reported once, when fullscreen starts or ends. + +// monitorWindow is the optional window control the app package looks for. +type monitorWindow interface { + Monitors() ([]platform.Monitor, error) + SetFullscreenAllMonitors(bool) error +} + +var _ monitorWindow = (*nativeWindow)(nil) func (window *nativeWindow) SetFullscreen(fullscreen bool) error { if window == nil || window.closed.Load() { @@ -16,15 +37,134 @@ func (window *nativeWindow) SetFullscreen(fullscreen bool) error { return nil } +// SetFullscreenAllMonitors is SetFullscreen across every monitor. A desktop with one +// monitor has nothing to span and takes it as SetFullscreen; with several, the window +// manager must support _NET_WM_FULLSCREEN_MONITORS, else the window is left as it is. +func (window *nativeWindow) SetFullscreenAllMonitors(fullscreen bool) error { + if !fullscreen { + return window.SetFullscreen(false) + } + if window == nil || window.closed.Load() { + return fmt.Errorf("linux: window is closed") + } + win := window.state.win + win.mu.Lock() + monitors, err := win.serverMonitors() + spans := len(monitors) > 1 + supported := true + if err == nil && spans { + supported, err = win.supportsHint(win.frame.fullscreenMonitors) + } + win.mu.Unlock() + win.postClientMessage(win.commandAtom, commandWake) + if err != nil { + return err + } + if !supported { + return platform.ErrFullscreenAllMonitorsUnsupported + } + // The loop reads the monitors again when it acts: they are the ones it spans. + win.postClientMessage(win.commandAtom, commandFullscreenAllMonitors) + return nil +} + +// Monitors lists the displays: the primary one first, then the others left to right and top +// to bottom, in device pixels with the primary one's top-left corner as the origin. It asks +// the X server, so it is current after a monitor is plugged in, and any goroutine may call it. +func (window *nativeWindow) Monitors() ([]platform.Monitor, error) { + if window == nil || window.closed.Load() { + return nil, fmt.Errorf("linux: window is closed") + } + win := window.state.win + win.mu.Lock() + monitors, err := win.serverMonitors() + var scales []float32 + if err == nil { + for _, monitor := range monitors { + scales = append(scales, win.tracker.scaleOf(monitor)) + } + } + win.mu.Unlock() + // The replies may have moved events into the queue the loop sleeps without looking at. + win.postClientMessage(win.commandAtom, commandWake) + if err != nil { + return nil, err + } + return listedMonitors(monitors, scales), nil +} + func (window *nativeWindow) Fullscreen() bool { return window != nil && !window.closed.Load() && window.state.win.fullscreen.Load() } +// serverMonitors reads the monitors from the server, in its numbering. The caller holds mu. +func (win *window) serverMonitors() ([]monitorGeometry, error) { + if win.connection == 0 || win.tracker == nil { + return nil, fmt.Errorf("linux: window is closed") + } + return win.tracker.readMonitors(nil), nil +} + +// enterFullscreen is the request to become fullscreen, on the loop. A window that spans is +// told to cover one monitor again unless span asks for all of them. +func (win *window) enterFullscreen(span bool) { + monitors := win.currentMonitors() + if span && len(monitors) > 1 { + if edges, ok := fullscreenEdges(monitors); ok { + if !win.spanning { + x, y := win.rootOrigin() + win.spanReturn = monitorIndexAt(monitors, int(x)+int(win.width)/2, int(y)+int(win.height)/2) + } + win.spanning = true + win.sendFullscreenMonitors(edges) + } + } else if win.spanning { + win.resetFullscreenMonitors(monitors) + } + win.sendToRoot(win.frame.stateAtom, [5]uint32{netWMStateAdd, win.frame.fullscreen, 0, sourceApp}) +} + +// exitFullscreen leaves fullscreen, and forgets any span so the next fullscreen is on one +// monitor: the window manager keeps the monitors it was given. +func (win *window) exitFullscreen() { + win.sendToRoot(win.frame.stateAtom, [5]uint32{netWMStateRemove, win.frame.fullscreen, 0, sourceApp}) + if win.spanning { + win.resetFullscreenMonitors(win.currentMonitors()) + } +} + +// currentMonitors reads the monitors again, for the loop. +func (win *window) currentMonitors() []monitorGeometry { + if win.tracker == nil { + return nil + } + win.tracker.reloadMonitors() + return win.tracker.monitors +} + +// resetFullscreenMonitors names one monitor, the one the window was on before it spanned. +func (win *window) resetFullscreenMonitors(monitors []monitorGeometry) { + index := win.spanReturn + if index < 0 || index >= len(monitors) { + index = max(primaryMonitorIndex(monitors), 0) + } + win.spanning = false + win.sendFullscreenMonitors(singleMonitorEdges(index)) +} + +func (win *window) sendFullscreenMonitors(edges [4]uint32) { + win.sendToRoot(win.frame.fullscreenMonitors, [5]uint32{edges[0], edges[1], edges[2], edges[3], sourceApp}) +} + func (win *window) observeFullscreen(fullscreen bool) { if win.fullscreen.Swap(fullscreen) == fullscreen { return } win.frame.pending = false + if !fullscreen && win.spanning && win.connection != 0 && win.api != nil { + // The window manager ended it (a key of its own): the next fullscreen is on one monitor. + win.resetFullscreenMonitors(win.currentMonitors()) + } if win.fullscreenHandler != nil { win.fullscreenHandler(fullscreen) } diff --git a/internal/platform/linux/fullscreen_monitors_linux_test.go b/internal/platform/linux/fullscreen_monitors_linux_test.go new file mode 100644 index 000000000..3027fc70d --- /dev/null +++ b/internal/platform/linux/fullscreen_monitors_linux_test.go @@ -0,0 +1,158 @@ +//go:build linux && !android + +package linux + +import ( + "encoding/binary" + "testing" + "unsafe" +) + +// sentMessage is one client message the window sent to the root window. +type sentMessage struct { + kind uint32 + data [5]uint32 +} + +const ( + testStateAtom = 10 + testFullscreenAtom = 11 + testFullscreenMonitorAtom = 12 +) + +// spanTestWindow is a window whose server has the given monitors, in this order, and whose +// window is at (x, y) of the screen. +func spanTestWindow(infos []randrMonitorInfo, x, y int16, sent *[]sentMessage) *window { + api := &xcbAPI{ + sendEvent: func(_ uintptr, _ uint8, _, _ uint32, data *byte) xcbVoidCookie { + message := (*xcbClientEvent)(unsafe.Pointer(data)) + var words [5]uint32 + for index := range words { + words[index] = binary.LittleEndian.Uint32(message.Data[index*4:]) + } + *sent = append(*sent, sentMessage{kind: message.Type, data: words}) + return xcbVoidCookie{} + }, + flush: func(uintptr) int32 { return 0 }, + free: func(unsafe.Pointer) {}, + translateCoordinates: func(uintptr, uint32, uint32, int16, int16) xcbTranslateCookie { + return xcbTranslateCookie{} + }, + translateCoordinatesReply: func(uintptr, xcbTranslateCookie, *unsafe.Pointer) *xcbTranslateReply { + return &xcbTranslateReply{DstX: x, DstY: y} + }, + } + randr := &randrAPI{ + getMonitors: func(uintptr, uint32, uint8) xcbVoidCookie { return xcbVoidCookie{} }, + monitorsRep: func(uintptr, xcbVoidCookie, *unsafe.Pointer) *randrMonitorsReply { return &randrMonitorsReply{} }, + iterator: func(*randrMonitorsReply) randrMonitorIterator { + return randrMonitorIterator{Data: &infos[0], Rem: int32(len(infos))} + }, + next: func(iterator *randrMonitorIterator) { + iterator.Rem-- + iterator.Data = (*randrMonitorInfo)(unsafe.Add(unsafe.Pointer(iterator.Data), unsafe.Sizeof(randrMonitorInfo{}))) + }, + } + screen := &xcbScreen{Root: 1, WidthPixels: 1920, HeightPixels: 1080} + return &window{ + api: api, connection: 1, id: 2, screen: screen, width: 800, height: 600, + tracker: &scaleTracker{api: api, connection: 1, screen: screen, randr: randr}, + frame: frameState{stateAtom: testStateAtom, fullscreen: testFullscreenAtom, fullscreenMonitors: testFullscreenMonitorAtom}, + } +} + +func threeMonitors() []randrMonitorInfo { + return []randrMonitorInfo{ + {Primary: 1, X: 0, Y: 0, Width: 1920, Height: 1080}, + {X: 1920, Y: 100, Width: 1280, Height: 1024}, + {X: -1280, Y: 0, Width: 1280, Height: 800}, + } +} + +func TestSpanningMonitorsNeverLeavesFullscreen(t *testing.T) { + var sent []sentMessage + win := spanTestWindow(threeMonitors(), 2000, 300, &sent) // the window is on monitor 1 + + win.enterFullscreen(true) + // top: monitor 0 (first with the highest top), bottom: 1 (lowest bottom edge), left: 2, right: 1. + want := []sentMessage{ + {testFullscreenMonitorAtom, [5]uint32{0, 1, 2, 1, sourceApp}}, + {testStateAtom, [5]uint32{netWMStateAdd, testFullscreenAtom, 0, sourceApp, 0}}, + } + if len(sent) != len(want) || sent[0] != want[0] || sent[1] != want[1] { + t.Fatalf("spanning sent %v, want %v", sent, want) + } + if !win.spanning { + t.Fatal("the window does not know it spans") + } + + // One monitor again: the one the window was on, and no state is removed. + sent = nil + win.enterFullscreen(false) + if win.spanning { + t.Fatal("the window still thinks it spans") + } + want = []sentMessage{ + {testFullscreenMonitorAtom, [5]uint32{1, 1, 1, 1, sourceApp}}, + {testStateAtom, [5]uint32{netWMStateAdd, testFullscreenAtom, 0, sourceApp, 0}}, + } + if len(sent) != len(want) || sent[0] != want[0] || sent[1] != want[1] { + t.Fatalf("going back to one monitor sent %v, want %v", sent, want) + } + for _, message := range sent { + if message.kind == testStateAtom && message.data[0] == netWMStateRemove { + t.Fatal("the switch left fullscreen") + } + } +} + +func TestLeavingFullscreenForgetsTheSpan(t *testing.T) { + var sent []sentMessage + win := spanTestWindow(threeMonitors(), 10, 10, &sent) + + win.enterFullscreen(false) + win.exitFullscreen() + for _, message := range sent { + if message.kind == testFullscreenMonitorAtom { + t.Fatalf("a window that never spanned sent monitors: %v", sent) + } + } + + sent = nil + win.enterFullscreen(true) + sent = nil + win.exitFullscreen() + if win.spanning { + t.Fatal("leaving fullscreen kept the span") + } + if len(sent) != 2 || sent[0].kind != testStateAtom || sent[0].data[0] != netWMStateRemove || + sent[1] != (sentMessage{testFullscreenMonitorAtom, [5]uint32{0, 0, 0, 0, sourceApp}}) { + t.Fatalf("leaving a span sent %v, want fullscreen removed and monitor 0 named", sent) + } +} + +func TestOneMonitorHasNothingToSpan(t *testing.T) { + var sent []sentMessage + win := spanTestWindow(threeMonitors()[:1], 10, 10, &sent) + win.enterFullscreen(true) + if win.spanning || len(sent) != 1 || sent[0].kind != testStateAtom { + t.Fatalf("one monitor spanned or sent %v", sent) + } +} + +func TestTheWindowManagerLeavingFullscreenEndsTheSpan(t *testing.T) { + var sent []sentMessage + win := spanTestWindow(threeMonitors(), 10, 10, &sent) + var states []bool + win.fullscreenHandler = func(fullscreen bool) { states = append(states, fullscreen) } + win.observeFullscreen(true) + win.enterFullscreen(true) + win.observeFullscreen(true) // the property is reported again as the monitors change + if len(states) != 1 { + t.Fatalf("a switch to all monitors reported %v", states) + } + win.observeFullscreen(false) + if win.spanning || len(states) != 2 || states[1] { + t.Fatalf("the window manager ending fullscreen left spanning=%v, reports %v", win.spanning, states) + } +} diff --git a/internal/platform/linux/fullscreen_monitors_live_linux_test.go b/internal/platform/linux/fullscreen_monitors_live_linux_test.go new file mode 100644 index 000000000..cebe56b90 --- /dev/null +++ b/internal/platform/linux/fullscreen_monitors_live_linux_test.go @@ -0,0 +1,135 @@ +//go:build linux && !android + +package linux + +import ( + "encoding/binary" + "os" + "os/exec" + "regexp" + "strconv" + "testing" + "time" + + "github.com/vivaui/viva/internal/platform" +) + +// This is the one test here that needs a window manager: it asks a real one for fullscreen +// across all monitors and reads back what it did, as another client sees it. It holds on any +// number of monitors; with one, spanning is the same as plain fullscreen. + +func windowIsFullscreen(t *testing.T, win *window) bool { + t.Helper() + data, format := windowProperty(t, win, "_NET_WM_STATE", xcbAtomAtom) + fullscreen, err := win.api.atom(win.connection, "_NET_WM_STATE_FULLSCREEN") + if err != nil { + t.Fatal(err) + } + if format != 32 { + return false + } + for offset := 0; offset+4 <= len(data); offset += 4 { + if binary.LittleEndian.Uint32(data[offset:]) == fullscreen { + return true + } + } + return false +} + +// windowSize is the size of the window the X server reports, in pixels. +func windowSize(t *testing.T, win *window) (int, int) { + t.Helper() + output, err := exec.Command("xwininfo", "-id", strconv.Itoa(int(win.id))).Output() + if err != nil { + t.Fatalf("xwininfo: %v", err) + } + read := func(name string) int { + match := regexp.MustCompile(name + `:\s+(\d+)`).FindSubmatch(output) + if match == nil { + t.Fatalf("no %s in %s", name, output) + } + value, _ := strconv.Atoi(string(match[1])) + return value + } + return read("Width"), read("Height") +} + +// waitFor gives the window manager a moment to act on a request. +func waitFor(condition func() bool) bool { + for deadline := time.Now().Add(5 * time.Second); time.Now().Before(deadline); time.Sleep(50 * time.Millisecond) { + if condition() { + return true + } + } + return condition() +} + +func TestNativeX11FullscreenCoversAllMonitors(t *testing.T) { + if os.Getenv("DISPLAY") == "" { + t.Skip("requires X11") + } + if _, err := exec.LookPath("xwininfo"); err != nil { + t.Skip("requires xwininfo") + } + win, err := openWindow(platform.Config{Title: "Viva fullscreen monitors test", Width: 400, Height: 300}) + if err != nil { + t.Skipf("no X window: %v", err) + } + defer win.close() + win.api.mapWindow(win.connection, win.id) + win.api.flush(win.connection) + window := &nativeWindow{state: &linuxWindowState{win: win}} + + monitors, err := window.Monitors() + if err != nil || len(monitors) == 0 { + t.Fatalf("Monitors() = %v, %v", monitors, err) + } + left, top, right, bottom := 0, 0, 0, 0 + for index, monitor := range monitors { + if monitor.Primary != (index == 0) || monitor.Scale < 1 || monitor.Width <= 0 || monitor.Height <= 0 { + t.Fatalf("monitor %d is wrong in %+v", index, monitors) + } + left, top = min(left, monitor.X), min(top, monitor.Y) + right, bottom = max(right, monitor.X+monitor.Width), max(bottom, monitor.Y+monitor.Height) + } + if monitors[0].X != 0 || monitors[0].Y != 0 { + t.Fatalf("the primary monitor is not at the origin: %+v", monitors[0]) + } + + // The requests are the event loop's; this test has none, so it runs them as the loop would. + run := func(command uint32) { + t.Helper() + if err := window.state.command(command, nil); err != nil { + t.Fatal(err) + } + win.api.flush(win.connection) + } + if err := window.SetFullscreenAllMonitors(true); err != nil { + t.Fatalf("SetFullscreenAllMonitors(true): %v", err) + } + run(commandFullscreenAllMonitors) + if !waitFor(func() bool { return windowIsFullscreen(t, win) }) { + t.Fatal("the window did not become fullscreen") + } + if !waitFor(func() bool { width, height := windowSize(t, win); return width == right-left && height == bottom-top }) { + width, height := windowSize(t, win) + t.Fatalf("fullscreen window is %dx%d, the monitors span %dx%d", width, height, right-left, bottom-top) + } + + // One monitor again, without leaving fullscreen. + run(commandEnterFullscreen) + time.Sleep(500 * time.Millisecond) + if !windowIsFullscreen(t, win) { + t.Fatal("going back to one monitor left fullscreen") + } + if len(monitors) == 1 { + if width, height := windowSize(t, win); width != monitors[0].Width || height != monitors[0].Height { + t.Fatalf("fullscreen window is %dx%d on a %dx%d monitor", width, height, monitors[0].Width, monitors[0].Height) + } + } + + run(commandExitFullscreen) + if !waitFor(func() bool { return !windowIsFullscreen(t, win) }) { + t.Fatal("the window did not leave fullscreen") + } +} diff --git a/internal/platform/linux/gtk_clipboard_sensitive_linux_test.go b/internal/platform/linux/gtk_clipboard_sensitive_linux_test.go new file mode 100644 index 000000000..1ab0238d4 --- /dev/null +++ b/internal/platform/linux/gtk_clipboard_sensitive_linux_test.go @@ -0,0 +1,95 @@ +//go:build linux && vivagtk + +package linux + +import ( + "errors" + "runtime" + "syscall" + "testing" + "unsafe" +) + +func TestGTKClipboardSensitiveWriteAndConditionalClear(t *testing.T) { + runtime.LockOSThread() + t.Cleanup(runtime.UnlockOSThread) + previousClipboards, previousHooks := clipboards, shellHooks.Load() + t.Cleanup(func() { + clipboards = previousClipboards + shellHooks.Store(previousHooks) + }) + + clearedCalls := 0 + textWrites := 0 + nextAtom := uintptr(10) + atoms := map[string]uintptr{} + clipboards = gtkClipboards{ + ok: true, clipboard: 17, + setText: func(board uintptr, value *byte, length int32) { textWrites++ }, + clear: func(board uintptr) { clearedCalls++ }, + atomIntern: func(name *byte, _ int32) uintptr { + key := goString(uintptr(unsafe.Pointer(name))) + if id, ok := atoms[key]; ok { + return id + } + nextAtom++ + atoms[key] = nextAtom + return nextAtom + }, + } + application := >kApplication{mainThread: syscall.Gettid()} + application.installHooks() + + if SupportsSensitiveClipboard() { + t.Fatal("GTK without set_with_data reports sensitive clipboard support") + } + if _, err := SetSensitiveClipboardText("secret"); !errors.Is(err, ErrUnsupported) { + t.Fatalf("GTK without set_with_data = %v, want ErrUnsupported", err) + } + + var setDataCount int32 + clipboards.setWithData = func(clipboard, targets uintptr, count int32, get, clearFn, data uintptr) int32 { + if clipboard != 17 || targets == 0 || get == 0 || clearFn == 0 { + t.Fatalf("unexpected set_with_data args: clipboard=%d targets=%d", clipboard, targets) + } + setDataCount = count + return 1 + } + clipboards.selectionGet = func(uintptr) uintptr { return 1 } + clipboards.selectionSet = func(data, kind uintptr, format int32, bytes *byte, length int32) int32 { return 1 } + application.installHooks() + if !SupportsSensitiveClipboard() { + t.Fatal("GTK with set_with_data reports no sensitive clipboard support") + } + + clearFn, err := SetSensitiveClipboardText("s3cret-gtk") + if err != nil { + t.Fatal(err) + } + if setDataCount != 5 { + t.Fatalf("target count = %d, want 5 (text flavours + x-kde-passwordManagerHint)", setDataCount) + } + hintAtom := atoms["x-kde-passwordManagerHint"] + if hintAtom == 0 || string(application.clipboardBytes[hintAtom]) != "secret" { + t.Fatalf("x-kde-passwordManagerHint = %q, want \"secret\"", application.clipboardBytes[hintAtom]) + } + + // Unchanged: clear empties GTK clipboard and reports true. + cleared, err := clearFn() + if err != nil || !cleared || clearedCalls != 1 { + t.Fatalf("clear unchanged: cleared=%v err=%v calls=%d", cleared, err, clearedCalls) + } + + // Replaced by a plain copy: clear skips clearing and reports false. + clearFn2, err := SetSensitiveClipboardText("ephemeral") + if err != nil { + t.Fatal(err) + } + if err := SetClipboardText("later text"); err != nil || textWrites != 1 { + t.Fatalf("SetClipboardText: err=%v writes=%d", err, textWrites) + } + cleared, err = clearFn2() + if err != nil || cleared || clearedCalls != 1 { + t.Fatalf("clear after replacement: cleared=%v err=%v calls=%d", cleared, err, clearedCalls) + } +} diff --git a/internal/platform/linux/gtk_library_linux.go b/internal/platform/linux/gtk_library_linux.go index d6ad83e9e..38ca55ad1 100644 --- a/internal/platform/linux/gtk_library_linux.go +++ b/internal/platform/linux/gtk_library_linux.go @@ -163,9 +163,13 @@ type gtkLibrary struct { gdkDisplaySeat func(display uintptr) uintptr gdkMonitorAtPoint func(display uintptr, x, y int32) uintptr gdkMonitorAtIndex func(display uintptr, index int32) uintptr + gdkDisplayMonitors func(display uintptr) int32 gdkDisplayMonitorAt func(display, window uintptr) uintptr gdkMonitorWorkarea func(monitor uintptr, rect *[4]int32) gdkMonitorGeometry func(monitor uintptr, rect *[4]int32) + // windowFullscreenMode is gdk_window_set_fullscreen_mode (GDK 3.8): nil when absent, which + // leaves the window unable to span monitors. + windowFullscreenMode func(window uintptr, mode int32) gdkWindowSetCursor func(window, cursor uintptr) gdkWindowNew func(parent uintptr, attrs *gdkWindowAttr, mask int32) uintptr gdkWindowShow func(window uintptr) @@ -465,6 +469,8 @@ func (g *gtkLibrary) bindAll() { b(&g.gdkDisplayMonitorAt, "gdk_display_get_monitor_at_window") b(&g.gdkMonitorAtPoint, "gdk_display_get_monitor_at_point") b(&g.gdkMonitorAtIndex, "gdk_display_get_monitor") + b(&g.gdkDisplayMonitors, "gdk_display_get_n_monitors") + g.lookup(&g.windowFullscreenMode, "gdk_window_set_fullscreen_mode") b(&g.gdkMonitorWorkarea, "gdk_monitor_get_workarea") b(&g.gdkMonitorGeometry, "gdk_monitor_get_geometry") b(&g.gdkWindowSetCursor, "gdk_window_set_cursor") diff --git a/internal/platform/linux/gtk_monitors_linux.go b/internal/platform/linux/gtk_monitors_linux.go new file mode 100644 index 000000000..3107b3be5 --- /dev/null +++ b/internal/platform/linux/gtk_monitors_linux.go @@ -0,0 +1,123 @@ +//go:build linux && vivagtk + +package linux + +import ( + "fmt" + + "github.com/vivaui/viva/internal/platform" +) + +// GDK_FULLSCREEN_ON_CURRENT_MONITOR and GDK_FULLSCREEN_ON_ALL_MONITORS. +const ( + gdkFullscreenCurrentMonitor = 0 + gdkFullscreenAllMonitors = 1 +) + +var _ monitorWindow = (*gtkWindow)(nil) + +// Monitors lists the displays GDK knows: the primary one first, then the others left to right +// and top to bottom, in device pixels with the primary one's top-left corner as the origin. GDK +// reports sizes in its own units (device pixels divided by its scale factor), so they are scaled +// back. It runs on the loop's thread and may be called from any goroutine. A Wayland compositor +// places the monitors in its own layout, which is reported as it is. +func (w *gtkWindow) Monitors() ([]platform.Monitor, error) { + if w == nil || w.app == nil { + return nil, fmt.Errorf("linux: window is closed") + } + var listed []platform.Monitor + var err error + if waitErr := w.app.onMain(func() { listed, err = w.listMonitors() }); waitErr != nil { + return nil, waitErr + } + return listed, err +} + +func (w *gtkWindow) listMonitors() ([]platform.Monitor, error) { + if w.closed { + return nil, fmt.Errorf("linux: window is closed") + } + g := w.g + display := g.gdkDisplayDefault() + if display == 0 { + return nil, fmt.Errorf("linux: no GDK display") + } + count := int(g.gdkDisplayMonitors(display)) + primary := g.gdkDisplayPrimary(display) + monitors := make([]monitorGeometry, 0, count) + scales := make([]float32, 0, count) + for index := range count { + monitor := g.gdkMonitorAtIndex(display, int32(index)) + if monitor == 0 { + continue + } + var rect [4]int32 + g.gdkMonitorGeometry(monitor, &rect) + unit, scale := int32(1), float32(1) + if w.app.wayland { + // The compositor's own factor is the only one GDK reports there. + unit = max(g.gdkMonitorScale(monitor), 1) + scale = float32(unit) + } else { + unit, scale = w.scaleOfMonitor(monitor) + } + monitors = append(monitors, monitorGeometry{ + X: int(rect[0]) * int(unit), Y: int(rect[1]) * int(unit), Width: int(rect[2]) * int(unit), Height: int(rect[3]) * int(unit), + Primary: monitor == primary, valid: true, + }) + scales = append(scales, scale) + } + return listedMonitors(monitors, scales), nil +} + +// SetFullscreenAllMonitors makes the window fullscreen across every monitor (GDK asks the +// window manager to cover the bounding box of them, _NET_WM_FULLSCREEN_MONITORS) or, with false, +// leaves fullscreen. A Wayland compositor decides where a window goes and has no way to span +// outputs, and a GDK without gdk_window_set_fullscreen_mode cannot ask: both leave the window as +// it is. +func (w *gtkWindow) SetFullscreenAllMonitors(fullscreen bool) error { + if w == nil || w.app == nil { + return fmt.Errorf("linux: window is closed") + } + if !fullscreen { + return w.SetFullscreen(false) + } + if w.app.wayland || w.g.windowFullscreenMode == nil { + return platform.ErrFullscreenAllMonitorsUnsupported + } + w.app.enqueue(func() { + if !w.closed { + w.fullscreenOn(true) + } + }) + return nil +} + +// fullscreenOn makes the window fullscreen on one monitor or on all of them, on the loop's +// thread. GDK sends the new monitors to a window that is already fullscreen, so a window switches +// between the two without leaving the state. +func (w *gtkWindow) fullscreenOn(all bool) { + if w.g.windowFullscreenMode != nil { + if window := w.g.widgetGetWindow(w.toplevel); window != 0 { + mode := int32(gdkFullscreenCurrentMonitor) + if all { + mode = gdkFullscreenAllMonitors + } + w.g.windowFullscreenMode(window, mode) + } + } + w.spanning = all + w.g.windowFullscreen(w.toplevel) +} + +// fullscreenOnOneMonitor forgets a span, so that the next fullscreen is on one monitor: GDK keeps +// the mode it was given. +func (w *gtkWindow) fullscreenOnOneMonitor() { + if !w.spanning || w.g.windowFullscreenMode == nil { + return + } + w.spanning = false + if window := w.g.widgetGetWindow(w.toplevel); window != 0 { + w.g.windowFullscreenMode(window, gdkFullscreenCurrentMonitor) + } +} diff --git a/internal/platform/linux/gtk_system_linux.go b/internal/platform/linux/gtk_system_linux.go index 191cd69c0..bf47b39c7 100644 --- a/internal/platform/linux/gtk_system_linux.go +++ b/internal/platform/linux/gtk_system_linux.go @@ -186,6 +186,25 @@ func (a *gtkApplication) installHooks() { return }, } + // The sensitive write needs gtk_clipboard_set_with_data; without it the + // hook stays nil so SupportsSensitiveClipboard and the write agree. + if c, err := a.clipboardAPI(); err == nil && c.setWithData != nil { + hooks.setSensitiveClipboardText = func(value string) (clearFn func() (bool, error), err error) { + var generation uintptr + if e := a.onMain(func() { generation, err = a.writeSensitiveText(value) }); e != nil { + return nil, e + } + if err != nil { + return nil, err + } + return func() (cleared bool, clearErr error) { + if e := a.onMain(func() { cleared, clearErr = a.clearSensitiveText(generation) }); e != nil { + return false, e + } + return cleared, clearErr + }, nil + } + } shellHooks.Store(hooks) } @@ -216,6 +235,8 @@ func (a *gtkApplication) writeText(primary bool, value string) error { board := c.clipboard if primary { board = c.primary + } else { + a.dropClipboardBytes() } if value == "" { c.clear(board) @@ -226,6 +247,14 @@ func (a *gtkApplication) writeText(primary bool, value string) error { return nil } +func (a *gtkApplication) dropClipboardBytes() { + for _, value := range a.clipboardBytes { + clear(value) + } + a.clipboardBytes = nil + a.clipboardGeneration++ +} + // gtkTargetEntry is C's GtkTargetEntry: the target's name, its flags and the // info the get callback matches on, laid out for the call that takes an array. type gtkTargetEntry struct { @@ -238,7 +267,7 @@ type gtkTargetEntry struct { // making them the first time: purego never releases a callback, so each copy // replaces what the callbacks answer (clipboardBytes) instead of making a pair // that would retain its bytes for the life of the process. -func (a *gtkApplication) clipboardCallbacks(c *gtkClipboards) (get, clear uintptr) { +func (a *gtkApplication) clipboardCallbacks(c *gtkClipboards) (getCb, clearCb uintptr) { if a.clipboardGet != 0 { return a.clipboardGet, a.clipboardClear } @@ -259,6 +288,9 @@ func (a *gtkApplication) clipboardCallbacks(c *gtkClipboards) (get, clear uintpt // A clear from an older copy arrives after the bytes of the new one are in // place; only the current copy's clear may drop them. if userData == a.clipboardGeneration { + for _, value := range a.clipboardBytes { + clear(value) + } a.clipboardBytes = nil } return 0 @@ -266,6 +298,67 @@ func (a *gtkApplication) clipboardCallbacks(c *gtkClipboards) (get, clear uintpt return a.clipboardGet, a.clipboardClear } +func (a *gtkApplication) writeSensitiveText(value string) (uintptr, error) { + c, err := a.clipboardAPI() + if err != nil { + return 0, err + } + if c.setWithData == nil { + return 0, ErrUnsupported + } + utf8Name := cString("UTF8_STRING") + mimeName := cString("text/plain;charset=utf-8") + textName := cString("TEXT") + stringName := cString("STRING") + hintName := cString("x-kde-passwordManagerHint") + targets := [5]gtkTargetEntry{ + {target: uintptr(unsafe.Pointer(&utf8Name[0]))}, + {target: uintptr(unsafe.Pointer(&mimeName[0]))}, + {target: uintptr(unsafe.Pointer(&textName[0]))}, + {target: uintptr(unsafe.Pointer(&stringName[0]))}, + {target: uintptr(unsafe.Pointer(&hintName[0]))}, + } + utf8Atom := c.atomIntern(&utf8Name[0], 0) + mimeAtom := c.atomIntern(&mimeName[0], 0) + textAtom := c.atomIntern(&textName[0], 0) + stringAtom := c.atomIntern(&stringName[0], 0) + hintAtom := c.atomIntern(&hintName[0], 0) + a.dropClipboardBytes() + plainBytes := []byte(value) + a.clipboardBytes = map[uintptr][]byte{ + utf8Atom: plainBytes, + mimeAtom: plainBytes, + textAtom: plainBytes, + stringAtom: latin1Clipboard(value), + hintAtom: []byte("secret"), + } + generation := a.clipboardGeneration + get, clearFn := a.clipboardCallbacks(c) + if c.setWithData(c.clipboard, uintptr(unsafe.Pointer(&targets[0])), int32(len(targets)), get, clearFn, generation) == 0 { + a.dropClipboardBytes() + return 0, fmt.Errorf("linux: gtk_clipboard_set_with_data failed") + } + runtime.KeepAlive(utf8Name) + runtime.KeepAlive(mimeName) + runtime.KeepAlive(textName) + runtime.KeepAlive(stringName) + runtime.KeepAlive(hintName) + return generation, nil +} + +func (a *gtkApplication) clearSensitiveText(generation uintptr) (bool, error) { + if generation == 0 || a.clipboardGeneration != generation || a.clipboardBytes == nil { + return false, nil + } + c, err := a.clipboardAPI() + if err != nil { + return false, err + } + a.dropClipboardBytes() + c.clear(c.clipboard) + return true, nil +} + // writeHTML makes the clipboard hold html as text/html with alt as its plain // text. GTK owns it through gtk_clipboard_set_with_data, whose get callback // answers the target the requestor asked for by the atom of its name. @@ -287,7 +380,7 @@ func (a *gtkApplication) writeHTML(html, alt string) error { textAtom := c.atomIntern(&textName[0], 0) // The get callback answers the pair by atom; replacing it drops the pair the // previous copy left without making another callback. - a.clipboardGeneration++ + a.dropClipboardBytes() a.clipboardBytes = map[uintptr][]byte{htmlAtom: []byte(html), textAtom: []byte(alt)} get, clear := a.clipboardCallbacks(c) if c.setWithData(c.clipboard, uintptr(unsafe.Pointer(&targets[0])), 2, get, clear, a.clipboardGeneration) == 0 { @@ -320,7 +413,7 @@ func (a *gtkApplication) writeImage(png []byte) error { pngAtom := c.atomIntern(&pngName[0], 0) // The get callback answers the picture by atom; replacing it drops the one the // previous copy left without making another callback. - a.clipboardGeneration++ + a.dropClipboardBytes() a.clipboardBytes = map[uintptr][]byte{pngAtom: append([]byte(nil), png...)} get, clear := a.clipboardCallbacks(c) if c.setWithData(c.clipboard, uintptr(unsafe.Pointer(&targets[0])), 1, get, clear, a.clipboardGeneration) == 0 { @@ -373,6 +466,7 @@ func (a *gtkApplication) writeFiles(paths []string) error { if c.setURIs == nil { return ErrUnsupported } + a.dropClipboardBytes() encoded := make([][]byte, len(paths)) pointers := make([]uintptr, len(paths)+1) for index, path := range paths { diff --git a/internal/platform/linux/gtk_window_linux.go b/internal/platform/linux/gtk_window_linux.go index 75c3a9488..da0714331 100644 --- a/internal/platform/linux/gtk_window_linux.go +++ b/internal/platform/linux/gtk_window_linux.go @@ -47,10 +47,13 @@ type gtkWindow struct { allocated0 bool cairoSurface uintptr - frame atomic.Pointer[gfx.Rect] - decoration gtkDecorationState - maximized bool - fullscreen atomic.Bool + frame atomic.Pointer[gfx.Rect] + decoration gtkDecorationState + maximized bool + fullscreen atomic.Bool + // spanning says the window was asked to be fullscreen on all monitors and has not been + // asked for one since; the loop's thread owns it (gtk_monitors_linux.go). + spanning bool minimized bool focused bool focusSerial uint64 // coalesces GDK focus transfers between a Wayland parent and its child @@ -309,6 +312,11 @@ func (w *gtkWindow) notificationMonitor(display uintptr) uintptr { // x11Scale decides the unit and the scale on X11 from the desktop's settings, in the order // display_scale.go gives. func (w *gtkWindow) x11Scale(display uintptr) (unit int32, scale float32) { + return w.scaleOfMonitor(w.g.gdkDisplayPrimary(display)) +} + +// scaleOfMonitor is x11Scale for one monitor, 0 for none: the unit and scale a window on it has. +func (w *gtkWindow) scaleOfMonitor(m uintptr) (unit int32, scale float32) { g := w.g unit = 1 var monitor monitorGeometry @@ -318,7 +326,7 @@ func (w *gtkWindow) x11Scale(display uintptr) (unit int32, scale float32) { QtScreenScaleFactors: os.Getenv("QT_SCREEN_SCALE_FACTORS"), GdkScale: os.Getenv("GDK_SCALE"), } - if m := g.gdkDisplayPrimary(display); m != 0 { + if m != 0 { unit = max(g.gdkMonitorScale(m), 1) var rect [4]int32 g.gdkMonitorGeometry(m, &rect) @@ -354,9 +362,10 @@ func (w *gtkWindow) SetFullscreen(fullscreen bool) error { w.app.enqueue(func() { if !w.closed { if fullscreen { - w.g.windowFullscreen(w.toplevel) + w.fullscreenOn(false) } else { w.g.windowUnfullscreen(w.toplevel) + w.fullscreenOnOneMonitor() } } }) diff --git a/internal/platform/linux/monitors.go b/internal/platform/linux/monitors.go new file mode 100644 index 000000000..e752c2099 --- /dev/null +++ b/internal/platform/linux/monitors.go @@ -0,0 +1,119 @@ +package linux + +import ( + "slices" + + "github.com/vivaui/viva/internal/platform" +) + +// The monitor list a window reports (platform.Monitor) and the monitor indices +// the window manager is asked to span (_NET_WM_FULLSCREEN_MONITORS). Both are +// worked out here from the monitors as the display server numbers them (RandR +// monitors on X11, GDK monitors under GTK), in the virtual screen's own +// coordinates: the first is the "monitor index" EWMH means, and the origin +// need not be the primary monitor's corner. + +// primaryMonitorIndex is the monitor the desktop's origin is on: the one the +// server calls primary, else the one that holds the virtual screen's origin +// (an X server with no primary set), else the first. It is -1 for no monitors. +func primaryMonitorIndex(monitors []monitorGeometry) int { + for index, monitor := range monitors { + if monitor.Primary { + return index + } + } + for index, monitor := range monitors { + if monitor.X <= 0 && monitor.Y <= 0 && monitor.X+monitor.Width > 0 && monitor.Y+monitor.Height > 0 { + return index + } + } + if len(monitors) == 0 { + return -1 + } + return 0 +} + +// listedMonitors converts the server's monitors to the list a window reports: +// device pixels with the primary monitor's top-left corner as the origin, the +// primary one first and the others from left to right, then top to bottom. +// scales are the monitors' device pixels per logical pixel, one each in the same order; a +// missing or non-positive one reads as 1. +func listedMonitors(monitors []monitorGeometry, scales []float32) []platform.Monitor { + primary := primaryMonitorIndex(monitors) + if primary < 0 { + return nil + } + originX, originY := monitors[primary].X, monitors[primary].Y + listed := make([]platform.Monitor, 0, len(monitors)) + for index, monitor := range monitors { + scale := float32(1) + if index < len(scales) && scales[index] > 0 { + scale = scales[index] + } + listed = append(listed, platform.Monitor{ + X: monitor.X - originX, Y: monitor.Y - originY, Width: monitor.Width, Height: monitor.Height, + Scale: scale, Primary: index == primary, + }) + } + // The primary monitor stays first; the others read left to right, then top to bottom. + slices.SortStableFunc(listed, func(a, b platform.Monitor) int { + switch { + case a.Primary != b.Primary: + if a.Primary { + return -1 + } + return 1 + case a.X != b.X: + return a.X - b.X + default: + return a.Y - b.Y + } + }) + return listed +} + +// fullscreenEdges are the four monitors _NET_WM_FULLSCREEN_MONITORS names: the +// indices of the monitors whose top, bottom, left and right edges form the edges of the bounding +// box of all monitors, in the order the property gives them. A monitor with an empty size is +// not counted. ok is false when there is none. +func fullscreenEdges(monitors []monitorGeometry) (edges [4]uint32, ok bool) { + top, bottom, left, right := -1, -1, -1, -1 + for index, monitor := range monitors { + if monitor.Width <= 0 || monitor.Height <= 0 { + continue + } + if top < 0 || monitor.Y < monitors[top].Y { + top = index + } + if bottom < 0 || monitor.Y+monitor.Height > monitors[bottom].Y+monitors[bottom].Height { + bottom = index + } + if left < 0 || monitor.X < monitors[left].X { + left = index + } + if right < 0 || monitor.X+monitor.Width > monitors[right].X+monitors[right].Width { + right = index + } + } + if top < 0 { + return edges, false + } + return [4]uint32{uint32(top), uint32(bottom), uint32(left), uint32(right)}, true +} + +// singleMonitorEdges names one monitor four times: the window manager takes +// that as fullscreen on that monitor alone, the way to leave a span. +func singleMonitorEdges(index int) [4]uint32 { + return [4]uint32{uint32(index), uint32(index), uint32(index), uint32(index)} +} + +// monitorIndexAt is the index of the monitor that holds the point, else the +// primary one: where a window whose center is at (x, y) is shown. +func monitorIndexAt(monitors []monitorGeometry, x, y int) int { + for index, monitor := range monitors { + if x >= monitor.X && x < monitor.X+monitor.Width && y >= monitor.Y && y < monitor.Y+monitor.Height { + return index + } + } + return max(primaryMonitorIndex(monitors), 0) +} diff --git a/internal/platform/linux/monitors_test.go b/internal/platform/linux/monitors_test.go new file mode 100644 index 000000000..4e2ae1af8 --- /dev/null +++ b/internal/platform/linux/monitors_test.go @@ -0,0 +1,143 @@ +package linux + +import ( + "slices" + "testing" + + "github.com/vivaui/viva/internal/platform" +) + +func TestListedMonitorsPutThePrimaryFirstAtTheOrigin(t *testing.T) { + // A left monitor, the primary in the middle (not at the server's origin) and one above-right. + monitors := []monitorGeometry{ + {X: 1920, Y: 0, Width: 1280, Height: 1024}, + {X: 0, Y: 0, Width: 1920, Height: 1080}, + {X: 3200, Y: 0, Width: 1920, Height: 1080}, + {X: 1920, Y: 1024, Width: 800, Height: 600}, + } + monitors[0].Primary = true + listed := listedMonitors(monitors, nil) + if len(listed) != len(monitors) { + t.Fatalf("%d monitors listed, want %d", len(listed), len(monitors)) + } + if !listed[0].Primary || listed[0].X != 0 || listed[0].Y != 0 || listed[0].Width != 1280 { + t.Fatalf("the primary is not first at the origin: %+v", listed) + } + primaries := 0 + for index, monitor := range listed { + if monitor.Primary { + primaries++ + } + if index < 2 { + continue + } + previous := listed[index-1] + if monitor.X < previous.X || monitor.X == previous.X && monitor.Y < previous.Y { + t.Fatalf("monitors %d and %d are out of order: %+v", index-1, index, listed) + } + } + if primaries != 1 { + t.Fatalf("%d primaries: %+v", primaries, listed) + } + // The monitor that was left of the primary is now at a negative X. + if !slices.ContainsFunc(listed, func(m platform.Monitor) bool { return m.X < 0 }) { + t.Fatalf("no monitor left of the primary has a negative X: %+v", listed) + } +} + +func TestListedMonitorsWithoutAPrimaryUseTheMonitorAtTheOrigin(t *testing.T) { + monitors := []monitorGeometry{ + {X: 1920, Width: 1920, Height: 1080}, + {X: 0, Width: 1920, Height: 1080}, + } + listed := listedMonitors(monitors, nil) + if !listed[0].Primary || listed[0].X != 0 || listed[1].X != 1920 || listed[1].Primary { + t.Fatalf("the monitor at the origin is not the primary: %+v", listed) + } + if listedMonitors(nil, nil) != nil { + t.Fatal("no monitors listed as some") + } +} + +func TestListedMonitorsCarryEachMonitorsScale(t *testing.T) { + monitors := []monitorGeometry{ + {Width: 1920, Height: 1080, Primary: true}, + {X: 1920, Width: 3840, Height: 2160}, + } + // The first is unknown (zero): a scale is never zero. + listed := listedMonitors(monitors, []float32{0, 2}) + if listed[0].Scale != 1 || listed[1].Scale != 2 { + t.Fatalf("scales %v and %v, want 1 and 2", listed[0].Scale, listed[1].Scale) + } +} + +func TestFullscreenEdgesFollowTheBoundingBox(t *testing.T) { + cases := []struct { + name string + monitors []monitorGeometry + want [4]uint32 // top, bottom, left, right + }{ + {"one", []monitorGeometry{{Width: 1920, Height: 1080}}, [4]uint32{0, 0, 0, 0}}, + {"side by side", []monitorGeometry{ + {Width: 1920, Height: 1080}, {X: 1920, Width: 1920, Height: 1080}, + }, [4]uint32{0, 0, 0, 1}}, + {"different heights and order", []monitorGeometry{ + {X: 1920, Y: 100, Width: 1280, Height: 1024}, // right, lower top, bottom 1124 + {Width: 1920, Height: 1080}, // left, top 0, bottom 1080 + {X: 3200, Y: -200, Width: 1024, Height: 768}, // far right, highest top + }, [4]uint32{2, 0, 1, 2}}, + {"stacked", []monitorGeometry{ + {Width: 1920, Height: 1080}, {Y: 1080, Width: 1920, Height: 1080}, {X: -1280, Y: 500, Width: 1280, Height: 800}, + }, [4]uint32{0, 1, 2, 0}}, + } + for _, c := range cases { + got, ok := fullscreenEdges(c.monitors) + if !ok || got != c.want { + t.Errorf("%s: edges %v ok=%v, want %v", c.name, got, ok, c.want) + } + // The four named monitors must span exactly the bounding box. + box := boundingBox(c.monitors) + spanned := boundingBox([]monitorGeometry{c.monitors[got[0]], c.monitors[got[1]], c.monitors[got[2]], c.monitors[got[3]]}) + if box != spanned { + t.Errorf("%s: edge monitors span %v, the screen is %v", c.name, spanned, box) + } + } + if _, ok := fullscreenEdges(nil); ok { + t.Error("edges of no monitors") + } + if _, ok := fullscreenEdges([]monitorGeometry{{}}); ok { + t.Error("edges of an empty monitor") + } +} + +func TestSingleMonitorEdgesNameOneMonitorFourTimes(t *testing.T) { + if got := singleMonitorEdges(3); got != [4]uint32{3, 3, 3, 3} { + t.Fatalf("edges %v", got) + } +} + +func TestMonitorIndexAtFallsBackToThePrimary(t *testing.T) { + monitors := []monitorGeometry{ + {X: 0, Width: 1920, Height: 1080}, + {X: 1920, Width: 1920, Height: 1080, Primary: true}, + } + if got := monitorIndexAt(monitors, 100, 100); got != 0 { + t.Fatalf("point on the first monitor: %d", got) + } + if got := monitorIndexAt(monitors, 2000, 500); got != 1 { + t.Fatalf("point on the second monitor: %d", got) + } + if got := monitorIndexAt(monitors, 9000, 9000); got != 1 { + t.Fatalf("point off every monitor: %d, want the primary", got) + } +} + +// boundingBox is left, top, right, bottom of the monitors. +func boundingBox(monitors []monitorGeometry) [4]int { + box := [4]int{monitors[0].X, monitors[0].Y, monitors[0].X + monitors[0].Width, monitors[0].Y + monitors[0].Height} + for _, monitor := range monitors[1:] { + box[0], box[1] = min(box[0], monitor.X), min(box[1], monitor.Y) + box[2], box[3] = max(box[2], monitor.X+monitor.Width), max(box[3], monitor.Y+monitor.Height) + } + return box +} diff --git a/internal/platform/linux/scale_x11_linux.go b/internal/platform/linux/scale_x11_linux.go index 1c4605a0f..13f3d9ccd 100644 --- a/internal/platform/linux/scale_x11_linux.go +++ b/internal/platform/linux/scale_x11_linux.go @@ -5,6 +5,7 @@ package linux import ( "os" "strconv" + "sync/atomic" "unsafe" "github.com/ebitengine/purego" @@ -41,6 +42,9 @@ type scaleTracker struct { resource string monitors []monitorGeometry randr *randrAPI + // published is what a scale is worked out from, for a goroutine that is not + // the event loop: the loop replaces it whenever the settings change. + published atomic.Pointer[scaleInputs] // origin is where the last answer came from; only RandR depends on where // the window is. origin scaleOrigin @@ -117,9 +121,32 @@ func (tracker *scaleTracker) reload() bool { if resource != tracker.resource { tracker.resource, changed = resource, true } + tracker.publishInputs() return changed } +// publishInputs makes the settings read so far available to scaleOf. +func (tracker *scaleTracker) publishInputs() { + inputs := tracker.environment + inputs.XSettings = tracker.settings + inputs.ResourceDPI = resourceDPI(tracker.resource) + tracker.published.Store(&inputs) +} + +// scaleOf is the display scale of a monitor under the settings last read. Unlike scale it +// leaves the tracker as it is and may be called from any goroutine. +func (tracker *scaleTracker) scaleOf(monitor monitorGeometry) float32 { + published := tracker.published.Load() + if published == nil { + return 1 + } + inputs := *published + inputs.Monitor = monitor + inputs.Screen = monitor.Name + scale, _ := chooseScale(inputs) + return scale +} + // property reads a whole property of a window. ok is false when it is absent. func (tracker *scaleTracker) property(window, property, kind uint32) ([]byte, bool) { api, connection := tracker.api, tracker.connection @@ -143,17 +170,24 @@ func (tracker *scaleTracker) property(window, property, kind uint32) ([]byte, bo // reloadMonitors asks RandR for the monitors. Without RandR 1.5 the whole screen // stands for one monitor, with the physical size the core protocol reports. func (tracker *scaleTracker) reloadMonitors() { - tracker.monitors = tracker.monitors[:0] + tracker.monitors = tracker.readMonitors(tracker.monitors[:0]) +} + +// readMonitors appends the monitors in the order the server numbers them, which is the +// index _NET_WM_FULLSCREEN_MONITORS means. It reads only the server, so any goroutine may +// call it while the connection is open. +func (tracker *scaleTracker) readMonitors(list []monitorGeometry) []monitorGeometry { if tracker.randr != nil { - tracker.monitors = tracker.randr.monitors(tracker.api, tracker.connection, tracker.screen.Root, tracker.monitors) + list = tracker.randr.monitors(tracker.api, tracker.connection, tracker.screen.Root, list) } - if len(tracker.monitors) == 0 { + if len(list) == 0 { screen := tracker.screen - tracker.monitors = append(tracker.monitors, monitorGeometry{ + list = append(list, monitorGeometry{ Width: int(screen.WidthPixels), Height: int(screen.HeightPixels), WidthMM: int(screen.WidthMillimeters), HeightMM: int(screen.HeightMillimeters), Primary: true, valid: true, }) } + return list } // scale is the display scale for a window whose center is at (x, y) in root diff --git a/internal/platform/linux/selection_linux.go b/internal/platform/linux/selection_linux.go index 6fe98a0f4..49b5095d8 100644 --- a/internal/platform/linux/selection_linux.go +++ b/internal/platform/linux/selection_linux.go @@ -66,6 +66,9 @@ func (win *window) ensureClipboardAtoms() error { if win.pngAtom, err = win.api.atom(win.connection, "image/png"); err != nil { return err } + if win.passwordHintAtom, err = win.api.atom(win.connection, "x-kde-passwordManagerHint"); err != nil { + return err + } return nil } @@ -188,8 +191,16 @@ func (win *window) handleSelectionRequest(request *xcbSelectionRequestEvent) err if request.Selection == win.clipboardAtom && len(win.clipboardImage) > 0 { targets = append(targets, win.pngAtom) } + if request.Selection == win.clipboardAtom && win.clipboardSecret && win.passwordHintAtom != 0 { + targets = append(targets, win.passwordHintAtom) + } win.api.changeProperty(win.connection, xcbPropertyReplace, request.Requestor, property, xcbAtomAtom, 32, uint32(len(targets)), unsafe.Pointer(&targets[0])) notify.Property = property + case win.passwordHintAtom: + if request.Selection == win.clipboardAtom && win.clipboardSecret && win.passwordHintAtom != 0 && + win.writeSelection(request.Requestor, property, request.Target, []byte("secret")) { + notify.Property = property + } case win.pngAtom: // The picture of an image copy, passed on as the PNG its owner wrote; // only the CLIPBOARD holds one, and only until another copy. @@ -210,8 +221,7 @@ func (win *window) handleSelectionRequest(request *xcbSelectionRequestEvent) err } case win.gnomeFilesAtom: if request.Selection == win.clipboardAtom && len(win.clipboardFiles) > 0 { - list := append([]byte("copy\n"), platform.FileURIList(win.clipboardFiles)...) - if win.writeSelection(request.Requestor, property, request.Target, list) { + if win.writeSelection(request.Requestor, property, request.Target, platform.GnomeCopiedFiles(win.clipboardFiles)) { notify.Property = property } } @@ -309,6 +319,7 @@ func (win *window) handleSelectionClear(event *xcbSelectionClearEvent) { switch { case event.Selection == win.clipboardAtom && win.clipboardAtom != 0: win.clipboard, win.clipboardHTML, win.clipboardFiles, win.clipboardImage = "", "", nil, nil + win.clipboardSecret = false win.ownsClipboard = false case event.Selection == xcbAtomPrimary: win.selections.primary = "" @@ -327,7 +338,10 @@ func (win *window) handleSelectionClear(event *xcbSelectionClearEvent) { func (win *window) saveClipboardToManager() { win.mu.Lock() connection, api := win.connection, win.api - owned := connection != 0 && win.ownsClipboard && (win.clipboard != "" || len(win.clipboardFiles) > 0 || len(win.clipboardImage) > 0) + // Concealed credentials must never be persisted to CLIPBOARD_MANAGER when the + // owning window exits. + owned := connection != 0 && win.ownsClipboard && !win.clipboardSecret && + (win.clipboard != "" || len(win.clipboardFiles) > 0 || len(win.clipboardImage) > 0) win.mu.Unlock() if !owned || api.convertSelection == nil { return diff --git a/internal/platform/linux/selection_linux_test.go b/internal/platform/linux/selection_linux_test.go index 0c967d265..3295ad668 100644 --- a/internal/platform/linux/selection_linux_test.go +++ b/internal/platform/linux/selection_linux_test.go @@ -4,6 +4,8 @@ package linux import ( "bytes" + "slices" + "strings" "testing" "unsafe" ) @@ -112,8 +114,13 @@ func TestAClipboardFileListIsOfferedAsURIsAndNames(t *testing.T) { if got := string(request(15).data); got != "file:///tmp/a%20b.txt\r\nfile:///tmp/%E4%B8%AD.txt\r\n" { t.Fatalf("text/uri-list = %q", got) } - if got := string(request(16).data); got != "copy\nfile:///tmp/a%20b.txt\r\nfile:///tmp/%E4%B8%AD.txt\r\n" { - t.Fatalf("gnome-copied-files = %q", got) + // Nautilus, Nemo and Caja split this target on "\n" alone and open every + // line after the first as a URI, so an empty line (a trailing newline) or a + // carriage return is a file they cannot name: the paste fails with + // "Error getting info for unknown". + lines := strings.Split(string(request(16).data), "\n") + if want := []string{"copy", "file:///tmp/a%20b.txt", "file:///tmp/%E4%B8%AD.txt"}; !slices.Equal(lines, want) { + t.Fatalf("gnome-copied-files lines = %q, want %q", lines, want) } if got := string(request(11).data); got != "a b.txt\n中.txt" { t.Fatalf("UTF8_STRING = %q", got) diff --git a/internal/platform/linux/shell_hooks_linux.go b/internal/platform/linux/shell_hooks_linux.go index 4538bf146..725806767 100644 --- a/internal/platform/linux/shell_hooks_linux.go +++ b/internal/platform/linux/shell_hooks_linux.go @@ -15,16 +15,17 @@ import ( var shellHooks atomic.Pointer[desktopHooks] type desktopHooks struct { - clipboardText func() (string, error) - setClipboardText func(string) error - setClipboardHTML func(html, alt string) error - hasClipboardImage func() bool - clipboardImagePNG func() ([]byte, error) - setClipboardImage func([]byte) error - clipboardFiles func() ([]string, error) - setClipboardFiles func([]string) error - primaryText func() (string, error) - setPrimaryText func(string) error - setCursorShape func(uint8) error - setCursorImage func(*gfx.CursorImage) error + clipboardText func() (string, error) + setClipboardText func(string) error + setSensitiveClipboardText func(string) (func() (bool, error), error) + setClipboardHTML func(html, alt string) error + hasClipboardImage func() bool + clipboardImagePNG func() ([]byte, error) + setClipboardImage func([]byte) error + clipboardFiles func() ([]string, error) + setClipboardFiles func([]string) error + primaryText func() (string, error) + setPrimaryText func(string) error + setCursorShape func(uint8) error + setCursorImage func(*gfx.CursorImage) error } diff --git a/internal/platform/linux/status_item_linux.go b/internal/platform/linux/status_item_linux.go index ef90b0465..ac23db7a4 100644 --- a/internal/platform/linux/status_item_linux.go +++ b/internal/platform/linux/status_item_linux.go @@ -232,15 +232,16 @@ func (state *linuxWindowState) command(command uint32, data []byte) error { win.api.configureWindow(win.connection, win.id, xcbConfigWindowWidth|xcbConfigWindowHeight, &size[0]) win.api.flush(win.connection) - case commandEnterFullscreen, commandExitFullscreen: - action := uint32(0) // _NET_WM_STATE_REMOVE - if command == commandEnterFullscreen { - action = 1 // _NET_WM_STATE_ADD - } - win.sendToRoot(win.frame.stateAtom, [5]uint32{action, win.frame.fullscreen, 0, sourceApp}) - if command == commandExitFullscreen && win.topmostConfigured.Load() && win.topmost.Load() { + case commandEnterFullscreen: + win.enterFullscreen(false) + case commandFullscreenAllMonitors: + win.enterFullscreen(true) + case commandExitFullscreen: + win.exitFullscreen() + if win.topmostConfigured.Load() && win.topmost.Load() { win.sendToRoot(win.frame.stateAtom, [5]uint32{1, win.frame.above, 0, sourceApp}) } + case commandWake: case commandHide: state.hidden = true state.exposed = false diff --git a/internal/platform/linux/system_linux.go b/internal/platform/linux/system_linux.go index 56dc2a2af..c8588a5a9 100644 --- a/internal/platform/linux/system_linux.go +++ b/internal/platform/linux/system_linux.go @@ -414,6 +414,7 @@ func (win *window) clipboardOwnedLocked() bool { return true } win.clipboard, win.clipboardHTML, win.clipboardFiles, win.clipboardImage = "", "", nil, nil + win.clipboardSecret = false win.ownsClipboard = false return false } diff --git a/internal/platform/linux/text_engine_linux.go b/internal/platform/linux/text_engine_linux.go index dd30015f9..e03756ab0 100644 --- a/internal/platform/linux/text_engine_linux.go +++ b/internal/platform/linux/text_engine_linux.go @@ -8,7 +8,6 @@ import ( "strings" "sync" "sync/atomic" - "unicode/utf8" "github.com/vivaui/viva/gfx" "github.com/vivaui/viva/internal/grapheme" @@ -218,9 +217,7 @@ func (engine *textEngine) shapeStyle(value string, size, weight float32, italic if !platform.ValidFontSize(size) { return nil, fmt.Errorf("linux: invalid font size") } - if !utf8.ValidString(value) { - return nil, fmt.Errorf("linux: text is not valid UTF-8") - } + value, _ = platform.ValidLabelText(value, nil) family := engine.family if family == "" { family = proportionalFamily diff --git a/internal/platform/linux/text_linux.go b/internal/platform/linux/text_linux.go index 116d2301b..fcc3de625 100644 --- a/internal/platform/linux/text_linux.go +++ b/internal/platform/linux/text_linux.go @@ -367,9 +367,7 @@ func (services *textServices) configureLayout(value, family string, size, weight if !platform.ValidFontSize(size) { return text.Metrics{}, fmt.Errorf("linux: invalid font size") } - if !utf8.ValidString(value) { - return text.Metrics{}, fmt.Errorf("linux: text is not valid UTF-8") - } + value, _ = platform.ValidLabelText(value, nil) description, err := services.description(family, size, weight, italic) if err != nil { return text.Metrics{}, err @@ -517,6 +515,7 @@ func (services *textServices) rasterize(label platform.TextLabel, scale float32, // columns, so every glyph keeps the phase it has in the whole line, and the columns // of services.spans are the window's. func (services *textServices) rasterizeWindow(label platform.TextLabel, scale float32, skip, width, height int, allowLCD bool) (pixels []byte, lcd bool, err error) { + label = validLabel(label) settings := systemFonts() services.spans = services.spans[:0] // A fixed-pitch label is LCD text too, unless it holds a color glyph, which has no @@ -815,3 +814,25 @@ func (services *textServices) Rasterize(label platform.TextLabel, scale float32, func (services *textServices) Spans() []vulkan.ColorSpan { return services.spans } func (services *textServices) Close() { services.close() } + +// validLabel is label with the bytes of its text that are not UTF-8 replaced, as a file +// name in another encoding holds them: Pango decodes the text and the label would +// otherwise fail, taking the window's frame with it. Valid text, the usual case, is +// returned as it is. +func validLabel(label platform.TextLabel) platform.TextLabel { + value, counts := platform.ValidLabelText(label.Value, label.Runs) + if counts == nil && len(label.Runs) == 0 { + label.Value = value + return label + } + if counts != nil { + runs := make([]gfx.TextRun, len(label.Runs)) + copy(runs, label.Runs) + for index := range runs { + runs[index].Bytes = counts[index] + } + label.Runs = runs + } + label.Value = value + return label +} diff --git a/internal/platform/linux/valid_label_linux_test.go b/internal/platform/linux/valid_label_linux_test.go new file mode 100644 index 000000000..29bd65abb --- /dev/null +++ b/internal/platform/linux/valid_label_linux_test.go @@ -0,0 +1,30 @@ +package linux + +import ( + "testing" + "unicode/utf8" + + "github.com/vivaui/viva/gfx" + "github.com/vivaui/viva/internal/platform" +) + +// A file name in another encoding reaches the text layer as a label; it must draw with +// replacement characters instead of failing the frame, and its runs must still cover +// the same text. +func TestValidLabelReplacesInvalidBytesAndKeepsRunsInStep(t *testing.T) { + label := validLabel(platform.TextLabel{Value: "caf\xe9.txt", Runs: []gfx.TextRun{{Bytes: 4}, {Bytes: 4}}}) + if !utf8.ValidString(label.Value) { + t.Fatalf("label text %q is not valid UTF-8", label.Value) + } + total := 0 + for _, run := range label.Runs { + total += int(run.Bytes) + } + if total != len(label.Value) { + t.Fatalf("runs cover %d bytes of %d", total, len(label.Value)) + } + plain := validLabel(platform.TextLabel{Value: "\xff"}) + if plain.Value != "�" { + t.Fatalf("plain label text = %q", plain.Value) + } +} diff --git a/internal/platform/linux/window_controls_linux.go b/internal/platform/linux/window_controls_linux.go index b593ad9e5..73b00d3a3 100644 --- a/internal/platform/linux/window_controls_linux.go +++ b/internal/platform/linux/window_controls_linux.go @@ -56,12 +56,14 @@ type frameState struct { maximizedHorizontal uint32 fullscreen uint32 above uint32 - maximized bool - maximizePending bool - maximizeTarget bool - lastPress uint32 - lastPressX, lastPressY int16 - pressed bool + // fullscreenMonitors is _NET_WM_FULLSCREEN_MONITORS (fullscreen_linux.go). + fullscreenMonitors uint32 + maximized bool + maximizePending bool + maximizeTarget bool + lastPress uint32 + lastPressX, lastPressY int16 + pressed bool // pending is a press on the frame that has not moved yet: the window // manager is asked to move or resize the window only once the pointer // drags, since a request made at the press can reach it after the button @@ -86,6 +88,7 @@ func (win *window) openFrame() error { {"_NET_WM_STATE_MAXIMIZED_HORZ", &win.frame.maximizedHorizontal}, {"_NET_WM_STATE_FULLSCREEN", &win.frame.fullscreen}, {"_NET_WM_STATE_ABOVE", &win.frame.above}, + {"_NET_WM_FULLSCREEN_MONITORS", &win.frame.fullscreenMonitors}, {"WM_CHANGE_STATE", &win.frame.changeStateAtom}, } { atom, err := win.api.atom(win.connection, item.name) @@ -97,7 +100,8 @@ func (win *window) openFrame() error { return nil } -func (win *window) supportsAbove() (bool, error) { +// supportsHint reports whether the window manager lists the atom in _NET_SUPPORTED. +func (win *window) supportsHint(hint uint32) (bool, error) { name, err := win.api.atom(win.connection, "_NET_SUPPORTED") if err != nil { return false, err @@ -121,7 +125,7 @@ func (win *window) supportsAbove() (bool, error) { return false, nil } for _, atom := range unsafe.Slice((*uint32)(win.api.getPropertyValue(reply)), int(length)/4) { - if atom == win.frame.above { + if atom == hint { return true, nil } } diff --git a/internal/platform/linux/window_linux.go b/internal/platform/linux/window_linux.go index 6f9a07d71..eb9a7c62e 100644 --- a/internal/platform/linux/window_linux.go +++ b/internal/platform/linux/window_linux.go @@ -24,11 +24,17 @@ import ( ) type window struct { - preview bool - fullscreen atomic.Bool - topmost atomic.Bool - topmostConfigured atomic.Bool - fullscreenHandler func(bool) + preview bool + fullscreen atomic.Bool + topmost atomic.Bool + topmostConfigured atomic.Bool + fullscreenHandler func(bool) + // spanning says the window was asked to be fullscreen across every monitor + // and has not been asked for one since; spanReturn is the monitor it was on + // before, the one a return to a single monitor names. The event loop owns + // both (fullscreen_linux.go). + spanning bool + spanReturn int minimumSize *minimumSizeCache mu sync.Mutex decorationRequest *x11DecorationRequest // guarded by mu @@ -53,22 +59,25 @@ type window struct { themed *themedCursors cursorsTried bool // render is what application cursor pictures need, tried once; renderErr says why it is nil. - render *xcbRender - renderTried bool - renderErr error - clipboard string - clipboardHTML string - clipboardFiles []string - clipboardImage []byte - clipboardAtom uint32 - htmlAtom uint32 - utf8Atom uint32 - textAtom uint32 - targetsAtom uint32 - uriListAtom uint32 - gnomeFilesAtom uint32 - pngAtom uint32 - ownsClipboard bool + render *xcbRender + renderTried bool + renderErr error + clipboard string + clipboardHTML string + clipboardFiles []string + clipboardImage []byte + clipboardAtom uint32 + htmlAtom uint32 + utf8Atom uint32 + textAtom uint32 + targetsAtom uint32 + uriListAtom uint32 + gnomeFilesAtom uint32 + pngAtom uint32 + passwordHintAtom uint32 + ownsClipboard bool + clipboardSecret bool + clipboardGeneration uint64 // clipboardFocusedAt is monotonicNow of the last time this window gained the // keyboard. A clipboard read in the moment after that can see no selection // owner (system_linux.go). @@ -237,6 +246,9 @@ const ( commandSetTitle commandPost commandSetIcon + commandFullscreenAllMonitors + // commandWake does nothing but make the loop look at its connection again. + commandWake ) type nativeWindow struct { diff --git a/internal/platform/valid_label_text.go b/internal/platform/valid_label_text.go new file mode 100644 index 000000000..e75cbf906 --- /dev/null +++ b/internal/platform/valid_label_text.go @@ -0,0 +1,56 @@ +package platform + +import ( + "unicode/utf8" + + "github.com/vivaui/viva/gfx" +) + +// ValidLabelText returns the text a label gives a platform text layer, which decodes +// it as UTF-8 and fails the whole label on a byte it cannot decode. A +// file name stored in another encoding on a remote host is such text. Each +// invalid byte becomes U+FFFD, as the platform text systems substitute it, so +// the label still draws and the rest of the window keeps updating. +// +// runBytes is the byte count of each run in the returned text, because a +// replacement changes the length of the bytes it stands for. It is nil when +// the text was already valid, and then the runs keep their own counts. +func ValidLabelText(value string, runs []gfx.TextRun) (string, []int32) { + if utf8.ValidString(value) { + return value, nil + } + // bounds holds the end of each run in value, clamped to its length, so the + // runs cover value in order and never past it. + bounds := make([]int, len(runs)) + end := 0 + for index, run := range runs { + end = min(end+int(max(run.Bytes, 0)), len(value)) + bounds[index] = end + } + ends := make([]int, len(runs)) + out := make([]byte, 0, len(value)+len(runs)) + next := 0 + for position := 0; position < len(value); { + for next < len(runs) && bounds[next] <= position { + ends[next] = len(out) + next++ + } + decoded, size := utf8.DecodeRuneInString(value[position:]) + if decoded == utf8.RuneError && size == 1 { + out = utf8.AppendRune(out, utf8.RuneError) + } else { + out = append(out, value[position:position+size]...) + } + position += size + } + for ; next < len(runs); next++ { + ends[next] = len(out) + } + counts := make([]int32, len(runs)) + previous := 0 + for index, at := range ends { + counts[index] = int32(at - previous) + previous = at + } + return string(out), counts +} diff --git a/internal/platform/darwin/native_label_text_darwin_test.go b/internal/platform/valid_label_text_test.go similarity index 85% rename from internal/platform/darwin/native_label_text_darwin_test.go rename to internal/platform/valid_label_text_test.go index 278282cef..9291c050f 100644 --- a/internal/platform/darwin/native_label_text_darwin_test.go +++ b/internal/platform/valid_label_text_test.go @@ -1,6 +1,4 @@ -//go:build darwin && !ios - -package darwin +package platform import ( "reflect" @@ -12,7 +10,7 @@ import ( // A remote file name in another encoding is not UTF-8; the native layer must still get text // it can decode, and the run byte counts must follow the replacement. -func TestNativeLabelTextReplacesInvalidUTF8(t *testing.T) { +func TestValidLabelTextReplacesInvalidUTF8(t *testing.T) { for _, test := range []struct { name string value string @@ -41,7 +39,7 @@ func TestNativeLabelTextReplacesInvalidUTF8(t *testing.T) { }, } { t.Run(test.name, func(t *testing.T) { - got, counts := nativeLabelText(test.value, test.runs) + got, counts := ValidLabelText(test.value, test.runs) if got != test.want { t.Fatalf("text = %q, want %q", got, test.want) } @@ -57,11 +55,11 @@ func TestNativeLabelTextReplacesInvalidUTF8(t *testing.T) { // Valid text is the common case on every redraw of every label: it must pass through // unchanged and without allocating. -func TestNativeLabelTextKeepsValidTextWithoutAllocating(t *testing.T) { +func TestValidLabelTextKeepsValidTextWithoutAllocating(t *testing.T) { value := "Viva 原生界面 👩‍💻" runs := []gfx.TextRun{{Bytes: 4}} allocs := testing.AllocsPerRun(100, func() { - got, counts := nativeLabelText(value, runs) + got, counts := ValidLabelText(value, runs) if got != value || counts != nil { t.Fatalf("valid text changed: %q, counts %v", got, counts) } diff --git a/internal/platform/web/painter.go b/internal/platform/web/painter.go index f316c6df2..2d87ca915 100644 --- a/internal/platform/web/painter.go +++ b/internal/platform/web/painter.go @@ -153,7 +153,7 @@ func (p *painter) keyDownCode(event gfx.KeyEvent, code uint32) bool { activated = true } p.focus.Refresh() - if !response.Handled && event.Key == gfx.KeyTab { + if !response.Handled && (event.Key == gfx.KeyTab || result.FooterTraversal) { p.focus.SetKeyboardFocus(!p.focus.Focused().IsZero()) } focusChanged := p.applyEventResult(response) @@ -443,6 +443,7 @@ func (p *painter) paint() { focused, visible := p.focus.PaintTarget() p.canvas.SetInteraction(p.pointer.Hovered(), p.pointer.Pressed(), focused, visible) p.canvas.SetHoveredRole(p.pointer.HoveredRole()) + p.canvas.SetHoveredDisabled(p.pointer.HoveredDisabled()) p.canvas.SetPointerOnSurface(p.onSurface) p.canvas.SetScroll(p.scrollX, p.scrollY) p.canvas.BeginFrame() @@ -497,9 +498,9 @@ func (p *painter) repaint() { p.advanceTouch() for pass := 0; ; pass++ { p.paint() - before := p.focus.Focused() + before, beforeVisible := p.focus.Focused(), p.focus.KeyboardFocus() p.focus.Sync(p.canvas) - if p.focus.Focused() == before || pass > 0 { + if pass > 0 || (p.focus.Focused() == before && p.focus.KeyboardFocus() == beforeVisible) { break } } @@ -675,7 +676,7 @@ func (p *painter) pointerInput(event gfx.PointerEvent) bool { } event.Viewport = gfx.Size{Width: p.width, Height: p.height} beforeHovered, beforePressed := p.pointer.Hovered(), p.pointer.Pressed() - beforeSurface := p.onSurface + beforeSurface, beforeDisabled := p.onSurface, p.pointer.HoveredDisabled() beforeFocus, beforeKeyboard := p.focus.Focused(), p.focus.KeyboardFocus() inside := event.X >= 0 && event.Y >= 0 && event.X < p.width && event.Y < p.height if event.Kind == gfx.PointerMove && p.pointerOutside && inside { @@ -692,6 +693,7 @@ func (p *painter) pointerInput(event gfx.PointerEvent) bool { p.pointerOutside = true p.pointer.SetHovered(gfx.ID{}) p.pointer.SetHoveredRole(gfx.Role(0)) + p.pointer.SetHoveredDisabled(gfx.ID{}) p.onSurface = false if beforeHovered.IsZero() { return false @@ -717,7 +719,7 @@ func (p *painter) pointerInput(event gfx.PointerEvent) bool { result.Repaint = true } if p.pointer.Hovered() == beforeHovered && p.pointer.Pressed() == beforePressed && - p.onSurface == beforeSurface && + p.onSurface == beforeSurface && p.pointer.HoveredDisabled() == beforeDisabled && p.focus.Focused() == beforeFocus && p.focus.KeyboardFocus() == beforeKeyboard && !focusChanged && !result.Repaint && !placed { if p.canvas.HasCursorImageAt() { @@ -752,8 +754,10 @@ func (p *painter) endPress(event gfx.PointerEvent) bool { func (p *painter) pointerStep(event gfx.PointerEvent) (result gfx.EventResult, focusChanged, placed bool) { p.pointer.SetHovered(gfx.ID{}) p.pointer.SetHoveredRole(gfx.Role(0)) + p.pointer.SetHoveredDisabled(gfx.ID{}) p.onSurface = false if event.Kind != gfx.PointerExit { + p.pointer.SetHoveredDisabled(p.focus.Router().DisabledAt(event.X, event.Y)) secondaryPress := event.Kind == gfx.PointerDown && event.Button == gfx.PointerButtonSecondary if target, ok, onSurface := p.focus.Router().PointerAt(event.X, event.Y, secondaryPress); ok || onSurface { p.pointer.SetHovered(target.Target) diff --git a/internal/platform/windows/clipboard_sensitive_windows.go b/internal/platform/windows/clipboard_sensitive_windows.go new file mode 100644 index 000000000..4c6987591 --- /dev/null +++ b/internal/platform/windows/clipboard_sensitive_windows.go @@ -0,0 +1,138 @@ +//go:build windows + +package windows + +import ( + "fmt" + "sync" + "syscall" + "unsafe" +) + +var ( + sensitiveClipboardFormatsOnce sync.Once + excludeMonitorFormat uintptr + canIncludeHistoryFormat uintptr + canUploadCloudFormat uintptr +) + +// sensitiveClipboardFormats registers the three Win32 formats that keep secret +// clipboard data out of clipboard monitors, local Win+V history and cloud sync. +func sensitiveClipboardFormats() (excludeMonitor, history, cloud uintptr) { + sensitiveClipboardFormatsOnce.Do(func() { + register := func(name string) uintptr { + utf16, err := syscall.UTF16PtrFromString(name) + if err != nil { + return 0 + } + id, _, _ := registerClipboardFormat.Call(uintptr(unsafe.Pointer(utf16))) + return id + } + excludeMonitorFormat = register("ExcludeClipboardContentFromMonitorProcessing") + canIncludeHistoryFormat = register("CanIncludeInClipboardHistory") + canUploadCloudFormat = register("CanUploadToCloudClipboard") + }) + return excludeMonitorFormat, canIncludeHistoryFormat, canUploadCloudFormat +} + +// SetSensitiveClipboardText writes value as CF_UNICODETEXT alongside Windows' +// monitor, history and cloud-clipboard exclusion formats in one transaction, +// and returns clear, which empties the clipboard only if its sequence number has +// not moved since the transaction. +func SetSensitiveClipboardText(value string) (func() (bool, error), error) { + encoded, err := syscall.UTF16FromString(value) + if err != nil { + return nil, fmt.Errorf("windows: encode clipboard text: %w", err) + } + defer clear(encoded) + + textBytes := make([]byte, len(encoded)*2) + for index, unit := range encoded { + textBytes[index*2] = byte(unit) + textBytes[index*2+1] = byte(unit >> 8) + } + defer clear(textBytes) + + excludeMonitor, history, cloud := sensitiveClipboardFormats() + if excludeMonitor == 0 || history == 0 || cloud == 0 { + return nil, fmt.Errorf("windows: register sensitive clipboard formats failed") + } + + lockClipboardThread() + defer unlockClipboardThread() + + owner := activeOwnerWindow() + if err := openClipboardForWrite(owner); err != nil { + return nil, err + } + closed := false + defer func() { + if !closed { + closeClipboard.Call() + } + }() + if emptied, _, callErr := emptyClipboard.Call(); emptied == 0 { + return nil, windowsCallError("empty clipboard", callErr) + } + if err := setClipboardBlock(clipboardUnicodeText, textBytes); err != nil { + return nil, err + } + var zeroDWORD [4]byte + for _, format := range [...]uintptr{excludeMonitor, history, cloud} { + if err := setClipboardBlock(format, zeroDWORD[:]); err != nil { + // Never leave unmarked plaintext on the clipboard if a concealment + // format could not be placed alongside it. + emptyClipboard.Call() + return nil, err + } + } + // While this thread holds the clipboard open no other process can change it, + // so the sequence number read here identifies exactly the content just + // written. Reading it only after CloseClipboard would leave a window in which + // another application's copy could be mistaken for ours. + openSequence := clipboardSequence() + closeClipboard.Call() + closed = true + // Microsoft documents GetClipboardSequenceNumber as advancing when the + // clipboard contents change or are emptied and does not say whether + // CloseClipboard (which finalizes synthesized text formats) also moves it. + // Remember the post-close value too and accept either in clear, so a + // number that moves on close cannot strand the secret. When close leaves it + // unchanged, which is the expected case, the two are equal and the window + // does not exist. This is not exercised on a real Windows host by the + // headless tests; VIVA_WINDOWS_CLIPBOARD=1 covers it there. + closedSequence := clipboardSequence() + + return func() (bool, error) { + cleared, err := clearClipboardAtSequence(openSequence) + if cleared || err != nil || closedSequence == openSequence { + return cleared, err + } + return clearClipboardAtSequence(closedSequence) + }, nil +} + +func clearClipboardAtSequence(sequence uint32) (bool, error) { + if sequence == 0 || clipboardSequence() != sequence { + return false, nil + } + lockClipboardThread() + defer unlockClipboardThread() + if clipboardSequence() != sequence { + return false, nil + } + owner := activeOwnerWindow() + if err := openClipboardForWrite(owner); err != nil { + return false, err + } + defer closeClipboard.Call() + // Re-check inside OpenClipboard so a write that landed just before open is + // never wiped. + if clipboardSequence() != sequence { + return false, nil + } + if emptied, _, callErr := emptyClipboard.Call(); emptied == 0 { + return false, windowsCallError("empty clipboard", callErr) + } + return true, nil +} diff --git a/internal/platform/windows/clipboard_sensitive_windows_test.go b/internal/platform/windows/clipboard_sensitive_windows_test.go new file mode 100644 index 000000000..89b3c5064 --- /dev/null +++ b/internal/platform/windows/clipboard_sensitive_windows_test.go @@ -0,0 +1,105 @@ +//go:build windows + +package windows + +import ( + "encoding/binary" + "os" + "testing" +) + +func TestSensitiveClipboardFormatsAreDistinctRegisteredIDs(t *testing.T) { + excludeMonitor, history, cloud := sensitiveClipboardFormats() + if excludeMonitor == 0 || history == 0 || cloud == 0 { + t.Fatalf("formats = (%d, %d, %d), want all non-zero", excludeMonitor, history, cloud) + } + if excludeMonitor == history || excludeMonitor == cloud || history == cloud { + t.Fatalf("formats collided: (%d, %d, %d)", excludeMonitor, history, cloud) + } +} + +func TestClearClipboardAtSequenceSkipsZeroAndMismatchedSequenceWithoutOpening(t *testing.T) { + previous := clipboardSequence + t.Cleanup(func() { clipboardSequence = previous }) + + var current uint32 = 42 + clipboardSequence = func() uint32 { return current } + + if cleared, err := clearClipboardAtSequence(0); err != nil || cleared { + t.Fatalf("zero sequence: cleared=%v err=%v, want false, nil", cleared, err) + } + if cleared, err := clearClipboardAtSequence(41); err != nil || cleared { + t.Fatalf("stale sequence: cleared=%v err=%v, want false, nil", cleared, err) + } +} + +func TestSetSensitiveClipboardTextRoundTripAndSequenceClear(t *testing.T) { + if os.Getenv("VIVA_WINDOWS_CLIPBOARD") == "" { + t.Skip("set VIVA_WINDOWS_CLIPBOARD=1 to overwrite the real clipboard") + } + t.Cleanup(func() { _ = SetClipboardText("") }) + + clearFn, err := SetSensitiveClipboardText("s3cret-value-中") + if err != nil { + t.Fatal(err) + } + got, err := ClipboardText() + if err != nil || got != "s3cret-value-中" { + t.Fatalf("ClipboardText = %q, %v, want secret", got, err) + } + + excludeMonitor, history, cloud := sensitiveClipboardFormats() + readFormat := func(format uintptr) ([]byte, error) { + lockClipboardThread() + defer unlockClipboardThread() + if err := openClipboardForWrite(0); err != nil { + return nil, err + } + defer closeClipboard.Call() + return clipboardBytes(format, 16) + } + for name, format := range map[string]uintptr{ + "ExcludeClipboardContentFromMonitorProcessing": excludeMonitor, + "CanIncludeInClipboardHistory": history, + "CanUploadToCloudClipboard": cloud, + } { + if available, _, _ := clipboardFormatAvailable.Call(format); available == 0 { + t.Fatalf("missing concealment format %s", name) + } + block, readErr := readFormat(format) + if readErr != nil { + t.Fatalf("read %s: %v", name, readErr) + } + if len(block) < 4 || binary.LittleEndian.Uint32(block[:4]) != 0 { + t.Fatalf("%s DWORD = %v, want 0", name, block) + } + } + + // Unchanged clipboard: clear empties it and reports true. + cleared, err := clearFn() + if err != nil || !cleared { + t.Fatalf("clear unchanged: cleared=%v err=%v, want true, nil", cleared, err) + } + if got, err := ClipboardText(); err != nil || got != "" { + t.Fatalf("after clear: text=%q err=%v, want empty", got, err) + } + + // Replaced clipboard: clear leaves the newer copy intact and reports false. + clearFn2, err := SetSensitiveClipboardText("ephemeral") + if err != nil { + t.Fatal(err) + } + if err := SetClipboardText("user copied later"); err != nil { + t.Fatal(err) + } + if available, _, _ := clipboardFormatAvailable.Call(excludeMonitor); available != 0 { + t.Fatal("plain copy kept sensitive monitor exclusion format") + } + cleared, err = clearFn2() + if err != nil || cleared { + t.Fatalf("clear after replacement: cleared=%v err=%v, want false, nil", cleared, err) + } + if got, err := ClipboardText(); err != nil || got != "user copied later" { + t.Fatalf("clipboard after skipped clear = %q, %v", got, err) + } +} diff --git a/internal/platform/windows/fullscreen_windows.go b/internal/platform/windows/fullscreen_windows.go index a07dcc883..41055c5ff 100644 --- a/internal/platform/windows/fullscreen_windows.go +++ b/internal/platform/windows/fullscreen_windows.go @@ -20,14 +20,34 @@ type windowPlacement struct { Normal rect } +// Values of the wmFullscreen request: leave, enter on the window's monitor, and +// enter across every monitor. +const ( + fullscreenOff = iota + fullscreenMonitor + fullscreenAllMonitors +) + // SetFullscreen queues an explicit state request on the owning window thread. func (window *nativeWindow) SetFullscreen(fullscreen bool) error { - if window == nil || window.closed.Load() { - return fmt.Errorf("windows: window is closed") + if fullscreen { + return window.requestFullscreen(fullscreenMonitor) } - value := uintptr(0) + return window.requestFullscreen(fullscreenOff) +} + +// SetFullscreenAllMonitors queues fullscreen over the box around every monitor. +// False leaves fullscreen. +func (window *nativeWindow) SetFullscreenAllMonitors(fullscreen bool) error { if fullscreen { - value = 1 + return window.requestFullscreen(fullscreenAllMonitors) + } + return window.requestFullscreen(fullscreenOff) +} + +func (window *nativeWindow) requestFullscreen(value uintptr) error { + if window == nil || window.closed.Load() { + return fmt.Errorf("windows: window is closed") } if ok, _, err := postMessage.Call(window.state.window, wmFullscreen, value, 0); ok == 0 { return fmt.Errorf("windows: request fullscreen: %w", err) @@ -39,10 +59,43 @@ func (window *nativeWindow) Fullscreen() bool { return window != nil && !window.closed.Load() && window.state.fullscreen.Load() } -func (state *windowState) setFullscreen(fullscreen bool) { +// fullscreenBounds is where a fullscreen window goes, in device pixels: the box +// around every monitor, or the whole of the monitor the window is mostly on, +// the taskbar's strip included. +func (state *windowState) fullscreenBounds() (rect, error) { + if state.fullscreenSpan { + if box, ok := virtualScreen(); ok { + return box, nil + } + } + monitor, _, _ := monitorFromWindow.Call(state.window, monitorNearest) + info := monitorInfo{Size: uint32(unsafe.Sizeof(monitorInfo{}))} + if ok, _, err := getMonitorInfo.Call(monitor, uintptr(unsafe.Pointer(&info))); ok == 0 { + return rect{}, fmt.Errorf("windows: get fullscreen monitor: %w", err) + } + return info.Monitor, nil +} + +// setFullscreen enters or leaves fullscreen; span says whether an entered +// window covers every monitor. A window already fullscreen changes between one +// monitor and all of them where it is, without a transition callback and +// without replacing the placement it restores on leaving. +func (state *windowState) setFullscreen(fullscreen, span bool) { + if fullscreen && state.fullscreen.Load() { + if state.fullscreenSpan != span { + state.fullscreenSpan = span + state.fitFullscreenMonitor() + if state.config.OnRedraw != nil { + frame, err := state.config.OnRedraw() + state.frame(frame, err) + } + } + return + } if fullscreen == state.fullscreen.Load() { return } + state.fullscreenSpan = fullscreen && span const styleIndex = ^uintptr(15) // GWL_STYLE = -16 state.fullscreenChanging = true defer func() { state.fullscreenChanging = false }() @@ -52,10 +105,10 @@ func (state *windowState) setFullscreen(fullscreen bool) { state.fail(fmt.Errorf("windows: remember fullscreen placement: %w", err)) return } - monitor, _, _ := monitorFromWindow.Call(state.window, monitorNearest) - info := monitorInfo{Size: uint32(unsafe.Sizeof(monitorInfo{}))} - if ok, _, err := getMonitorInfo.Call(monitor, uintptr(unsafe.Pointer(&info))); ok == 0 { - state.fail(fmt.Errorf("windows: get fullscreen monitor: %w", err)) + bounds, err := state.fullscreenBounds() + if err != nil { + state.fullscreenSpan = false + state.fail(err) return } style, _, _ := fullscreenGetStyle.Call(state.window, styleIndex) @@ -76,9 +129,9 @@ func (state *windowState) setFullscreen(fullscreen bool) { state.fail(err) return } - bounds := info.Monitor if ok, _, err := setWindowPosition.Call(state.window, 0, uintptr(bounds.Left), uintptr(bounds.Top), uintptr(bounds.Right-bounds.Left), uintptr(bounds.Bottom-bounds.Top), 0x34); ok == 0 { + state.fullscreenSpan = false state.fullscreen.Store(false) if state.config.OnFullscreen != nil { state.config.OnFullscreen(false) @@ -91,6 +144,7 @@ func (state *windowState) setFullscreen(fullscreen bool) { return } } else { + state.fullscreenSpan = false state.fullscreen.Store(false) if state.config.OnFullscreen != nil { state.config.OnFullscreen(false) @@ -112,10 +166,7 @@ func (state *windowState) setFullscreen(fullscreen bool) { } func (state *windowState) fitFullscreenMonitor() { - monitor, _, _ := monitorFromWindow.Call(state.window, monitorNearest) - info := monitorInfo{Size: uint32(unsafe.Sizeof(monitorInfo{}))} - if ok, _, _ := getMonitorInfo.Call(monitor, uintptr(unsafe.Pointer(&info))); ok != 0 { - bounds := info.Monitor + if bounds, err := state.fullscreenBounds(); err == nil { if ok, _, err := setWindowPosition.Call(state.window, 0, uintptr(bounds.Left), uintptr(bounds.Top), uintptr(bounds.Right-bounds.Left), uintptr(bounds.Bottom-bounds.Top), 0x34); ok == 0 { state.fail(fmt.Errorf("windows: resize fullscreen monitor: %w", err)) diff --git a/internal/platform/windows/monitors_windows.go b/internal/platform/windows/monitors_windows.go new file mode 100644 index 000000000..7403a1674 --- /dev/null +++ b/internal/platform/windows/monitors_windows.go @@ -0,0 +1,114 @@ +package windows + +import ( + "fmt" + "sort" + "sync" + "syscall" + "unsafe" + + "github.com/vivaui/viva/internal/platform" +) + +const ( + monitorInfoPrimary = 1 + // The virtual screen is the box around every monitor. + smXVirtualScreen = 76 + smYVirtualScreen = 77 + smCXVirtualScreen = 78 + smCYVirtualScreen = 79 +) + +var enumDisplayMonitors = user.NewProc("EnumDisplayMonitors") + +// enumeration holds the monitors one EnumDisplayMonitors call reports. The +// callback is created once, because a Go callback cannot be freed, so a call +// at a time uses it under the mutex. +var enumeration struct { + sync.Mutex + handles []uintptr + callback uintptr +} + +func enumerateMonitorHandles() ([]uintptr, error) { + enumeration.Lock() + defer enumeration.Unlock() + if enumeration.callback == 0 { + enumeration.callback = syscall.NewCallback(func(monitor, dc, bounds, data uintptr) uintptr { + enumeration.handles = append(enumeration.handles, monitor) + return 1 + }) + } + enumeration.handles = enumeration.handles[:0] + if ok, _, err := enumDisplayMonitors.Call(0, 0, enumeration.callback, 0); ok == 0 { + return nil, fmt.Errorf("windows: list monitors: %w", err) + } + return append([]uintptr(nil), enumeration.handles...), nil +} + +// listMonitors reads every monitor's bounds in device pixels of the virtual +// screen, where the primary monitor's top-left corner is the origin. +func listMonitors() ([]platform.Monitor, error) { + handles, err := enumerateMonitorHandles() + if err != nil { + return nil, err + } + monitors := make([]platform.Monitor, 0, len(handles)) + for _, handle := range handles { + info := monitorInfo{Size: uint32(unsafe.Sizeof(monitorInfo{}))} + if ok, _, err := getMonitorInfo.Call(handle, uintptr(unsafe.Pointer(&info))); ok == 0 { + return nil, fmt.Errorf("windows: read monitor: %w", err) + } + scale := float32(1) + if monitorEffectiveDPI.Find() == nil { + var dpiX, dpiY uint32 + if hr, _, _ := monitorEffectiveDPI.Call(handle, 0, uintptr(unsafe.Pointer(&dpiX)), uintptr(unsafe.Pointer(&dpiY))); int32(hr) == 0 && dpiX != 0 { + scale = float32(dpiX) / 96 + } + } + monitors = append(monitors, platform.Monitor{ + X: int(info.Monitor.Left), Y: int(info.Monitor.Top), + Width: int(info.Monitor.Right - info.Monitor.Left), Height: int(info.Monitor.Bottom - info.Monitor.Top), + Scale: scale, Primary: info.Flags&monitorInfoPrimary != 0, + }) + } + orderMonitors(monitors) + return monitors, nil +} + +// orderMonitors puts the primary monitor first and the others left to right, +// then top to bottom, so a caller sees the same order whatever the system's +// enumeration gives. +func orderMonitors(monitors []platform.Monitor) { + sort.SliceStable(monitors, func(a, b int) bool { + left, right := monitors[a], monitors[b] + if left.Primary != right.Primary { + return left.Primary + } + if left.X != right.X { + return left.X < right.X + } + return left.Y < right.Y + }) +} + +// virtualScreen is the box around every monitor. +func virtualScreen() (rect, bool) { + var box rect + read := func(index uintptr) int32 { + value, _, _ := getSystemMetrics.Call(index) + return int32(value) + } + box.Left, box.Top = read(smXVirtualScreen), read(smYVirtualScreen) + box.Right, box.Bottom = box.Left+read(smCXVirtualScreen), box.Top+read(smCYVirtualScreen) + return box, box.Right > box.Left && box.Bottom > box.Top +} + +// Monitors lists the displays of the desktop. It reads the system's current +// state and may be called from any goroutine. +func (window *nativeWindow) Monitors() ([]platform.Monitor, error) { + if window == nil || window.closed.Load() { + return nil, fmt.Errorf("windows: window is closed") + } + return listMonitors() +} diff --git a/internal/platform/windows/monitors_windows_test.go b/internal/platform/windows/monitors_windows_test.go new file mode 100644 index 000000000..65e8828b2 --- /dev/null +++ b/internal/platform/windows/monitors_windows_test.go @@ -0,0 +1,56 @@ +package windows + +import ( + "testing" + + "github.com/vivaui/viva/internal/platform" +) + +func TestOrderMonitorsPutsThePrimaryFirstThenReadsLeftToRight(t *testing.T) { + monitors := []platform.Monitor{ + {X: 1920, Width: 1280, Height: 1024}, + {X: -1280, Width: 1280, Height: 1024}, + {Width: 1920, Height: 1080, Primary: true}, + {X: 0, Y: 1080, Width: 1920, Height: 1080}, + } + orderMonitors(monitors) + if !monitors[0].Primary { + t.Fatalf("the primary monitor is not first: %+v", monitors) + } + for index := 2; index < len(monitors); index++ { + previous, current := monitors[index-1], monitors[index] + if current.X < previous.X || current.X == previous.X && current.Y < previous.Y { + t.Fatalf("monitors %d and %d are out of order: %+v", index-1, index, monitors) + } + } +} + +func TestListedMonitorsAreWithinTheVirtualScreen(t *testing.T) { + monitors, err := listMonitors() + if err != nil { + t.Skipf("no desktop to list: %v", err) + } + box, ok := virtualScreen() + if !ok || len(monitors) == 0 { + t.Skip("the session reports no monitors") + } + primaries := 0 + for _, monitor := range monitors { + if monitor.Primary { + primaries++ + if monitor.X != 0 || monitor.Y != 0 { + t.Fatalf("the primary monitor is not at the origin: %+v", monitor) + } + } + if monitor.Scale <= 0 || monitor.Width <= 0 || monitor.Height <= 0 { + t.Fatalf("empty monitor %+v", monitor) + } + if int32(monitor.X) < box.Left || int32(monitor.Y) < box.Top || + int32(monitor.X+monitor.Width) > box.Right || int32(monitor.Y+monitor.Height) > box.Bottom { + t.Fatalf("monitor %+v is outside the virtual screen %+v", monitor, box) + } + } + if primaries != 1 { + t.Fatalf("%d primary monitors", primaries) + } +} diff --git a/internal/platform/windows/status_item_windows.go b/internal/platform/windows/status_item_windows.go index 1192aac28..cd0a700f3 100644 --- a/internal/platform/windows/status_item_windows.go +++ b/internal/platform/windows/status_item_windows.go @@ -2,6 +2,7 @@ package windows import ( "errors" + "runtime" "sync" "sync/atomic" "syscall" @@ -27,13 +28,14 @@ const ( wmHideWindow = 32772 wmShowWindow = 32773 - wmActivate = 6 - waInactive = 0 - wmContextMenu = 0x007b - ninSelect = 0x0400 - ninKeySelect = 0x0401 - ninPopupOpen = 0x0406 - ninPopupClose = 0x0407 + wmActivate = 6 + waInactive = 0 + wmContextMenu = 0x007b + wmLButtonDblClk = 0x0203 + ninSelect = 0x0400 + ninKeySelect = 0x0401 + ninPopupOpen = 0x0406 + ninPopupClose = 0x0407 notifySetVersion = 4 notifyVersion4 = 4 @@ -324,6 +326,38 @@ func newStatusHandle(icon platform.StatusIcon) (uintptr, error) { return newIconHandle(icon.Scaled(int(size))) } +// fillIconPixels converts straight RGBA pixels into top-down 32bpp BGRA for +// CreateIconIndirect. Fully transparent pixels are zeroed so legacy AND/XOR +// fallback rendering leaves the background untouched instead of inverting it. +func fillIconPixels(dst, rgba []byte) { + for index := 0; index < len(dst); index += 4 { + if rgba[index+3] == 0 { + dst[index], dst[index+1], dst[index+2], dst[index+3] = 0, 0, 0, 0 + continue + } + dst[index], dst[index+1], dst[index+2], dst[index+3] = rgba[index+2], rgba[index+1], rgba[index], rgba[index+3] + } +} + +// iconMaskBits builds the 1bpp top-down AND mask for CreateBitmap (each scan +// line padded to a 16-bit WORD boundary, MSB first). A 1 bit marks a +// transparent pixel (alpha == 0). Windows treats a 32bpp HICON whose alpha +// channel is entirely zero as a legacy mask-only icon; without transparent mask +// bits, a blank blinking tray frame renders as a solid black square. +func iconMaskBits(size int, rgba []byte) []byte { + rowBytes := ((size + 15) / 16) * 2 + mask := make([]byte, rowBytes*size) + for y := 0; y < size; y++ { + row := mask[y*rowBytes:] + for x := 0; x < size; x++ { + if rgba[(y*size+x)*4+3] == 0 { + row[x>>3] |= 0x80 >> (x & 7) + } + } + } + return mask +} + // newIconHandle makes an HICON of the icon at its own size. func newIconHandle(scaled platform.StatusIcon) (uintptr, error) { size := uintptr(scaled.Size) @@ -341,10 +375,10 @@ func newIconHandle(scaled platform.StatusIcon) (uintptr, error) { } defer deleteObject.Call(color) pixels := unsafe.Slice((*byte)(bits), int(size*size*4)) - for index := 0; index < len(pixels); index += 4 { - pixels[index], pixels[index+1], pixels[index+2], pixels[index+3] = scaled.RGBA[index+2], scaled.RGBA[index+1], scaled.RGBA[index], scaled.RGBA[index+3] - } - mask, _, callErr := createBitmap.Call(size, size, 1, 1, 0) + fillIconPixels(pixels, scaled.RGBA) + maskBits := iconMaskBits(scaled.Size, scaled.RGBA) + mask, _, callErr := createBitmap.Call(size, size, 1, 1, uintptr(unsafe.Pointer(&maskBits[0]))) + runtime.KeepAlive(maskBits) if mask == 0 { return 0, windowsCallError("create the icon mask", callErr) } @@ -434,10 +468,12 @@ func (status *statusState) notified(window, anchor, packed uintptr) { // Version 4 reports one press twice: a left click is both WM_LBUTTONUP and // NIN_SELECT, a right click both WM_RBUTTONUP and WM_CONTEXTMENU. Only the second // of each is taken, because it also covers the keyboard (Enter or Space on the -// icon, the context menu key), which sends no button message. +// icon, the context menu key), which sends no button message. A left double-click +// delivers WM_LBUTTONDBLCLK without a second NIN_SELECT on modern shells, so it +// is mapped to primary activation as well. func statusButton(event uint32) (gfx.PointerButton, bool) { switch event { - case ninSelect, ninKeySelect: + case ninSelect, ninKeySelect, wmLButtonDblClk: return gfx.PointerButtonPrimary, true case wmContextMenu: return gfx.PointerButtonSecondary, true diff --git a/internal/platform/windows/status_item_windows_test.go b/internal/platform/windows/status_item_windows_test.go index 6cd297432..e7f73f56a 100644 --- a/internal/platform/windows/status_item_windows_test.go +++ b/internal/platform/windows/status_item_windows_test.go @@ -66,6 +66,8 @@ func TestStatusNotificationRoutesActivationAndContextMenu(t *testing.T) { wantButton gfx.PointerButton }{ {"left with callback and menu", true, true, false, []uint32{0x0201, 0x0202, ninSelect}, 1, 0, gfx.PointerButtonPrimary}, + {"left double click with callback and menu", true, true, false, []uint32{wmLButtonDblClk, 0x0202}, 1, 0, gfx.PointerButtonPrimary}, + {"left single then double click with callback and menu", true, true, false, []uint32{0x0201, 0x0202, ninSelect, wmLButtonDblClk, 0x0202}, 2, 0, gfx.PointerButtonPrimary}, {"keyboard activation", true, true, false, []uint32{ninKeySelect}, 1, 0, gfx.PointerButtonPrimary}, {"right with callback and menu", true, true, false, []uint32{0x0204, 0x0205, wmContextMenu}, 0, 1, gfx.PointerButtonNone}, {"left menu only", false, true, false, []uint32{ninSelect}, 0, 1, gfx.PointerButtonNone}, @@ -139,7 +141,11 @@ func TestStatusMessagesOfOneClickCountOnce(t *testing.T) { if primary, _ := count([]uint32{ninKeySelect}); primary != 1 { t.Fatal("selecting the icon from the keyboard did nothing") } - if primary, secondary := count([]uint32{moveOver, 0x0201, 0x0203}); primary+secondary != 0 { + // Double-click arrives as WM_LBUTTONDBLCLK without a second NIN_SELECT. + if primary, secondary := count([]uint32{wmLButtonDblClk, leftUp}); primary != 1 || secondary != 0 { + t.Fatalf("a left double click counted %d primary and %d secondary", primary, secondary) + } + if primary, secondary := count([]uint32{moveOver, 0x0201, 0x0204}); primary+secondary != 0 { t.Fatal("a message that is not a click counted as one") } } @@ -285,3 +291,54 @@ func TestNotificationCarrierRecoversAfterAModifyAndAddFailure(t *testing.T) { t.Fatalf("the carrier did not recover: added=%v window=%#x", notificationAdded, notificationWindow) } } + +func TestIconMaskBitsMarksTransparentPixelsAndPadsToWord(t *testing.T) { + // Fully transparent 16x16 icon (e.g. blank blinking tray frame) must set + // every pixel bit in the 1bpp AND mask so Windows does not render black. + blank := make([]byte, 16*16*4) + blankMask := iconMaskBits(16, blank) + if len(blankMask) != 16*2 { + t.Fatalf("16x16 mask length = %d, want 32", len(blankMask)) + } + for i, b := range blankMask { + if b != 0xff { + t.Fatalf("16x16 blank mask byte %d = %#02x, want 0xff", i, b) + } + } + + // Non-multiple-of-16 size (3x3) must pad each scan line to 2 bytes (1 WORD) + // and set only alpha==0 pixels, MSB first. + rgba := []byte{ + 0, 0, 0, 0, 255, 0, 0, 255, 0, 0, 0, 0, // row 0: transparent, opaque, transparent -> 1010_0000 = 0xa0 + 10, 20, 30, 1, 0, 0, 0, 0, 40, 50, 60, 255, // row 1: opaque, transparent, opaque -> 0100_0000 = 0x40 + 1, 2, 3, 255, 4, 5, 6, 255, 7, 8, 9, 0, // row 2: opaque, opaque, transparent -> 0010_0000 = 0x20 + } + got := iconMaskBits(3, rgba) + want := []byte{0xa0, 0x00, 0x40, 0x00, 0x20, 0x00} + if len(got) != len(want) { + t.Fatalf("3x3 mask length = %d, want %d", len(got), len(want)) + } + for i := range want { + if got[i] != want[i] { + t.Fatalf("3x3 mask[%d] = %#02x, want %#02x", i, got[i], want[i]) + } + } +} + +func TestFillIconPixelsConvertsBGRAAndZeroesTransparentRGB(t *testing.T) { + rgba := []byte{ + 10, 20, 30, 255, // opaque + 99, 88, 77, 0, // transparent with non-zero RGB + } + dst := make([]byte, len(rgba)) + fillIconPixels(dst, rgba) + want := []byte{ + 30, 20, 10, 255, + 0, 0, 0, 0, + } + for i := range want { + if dst[i] != want[i] { + t.Fatalf("dst[%d] = %d, want %d", i, dst[i], want[i]) + } + } +} diff --git a/internal/platform/windows/window_windows.go b/internal/platform/windows/window_windows.go index 880280ace..a1fd41746 100644 --- a/internal/platform/windows/window_windows.go +++ b/internal/platform/windows/window_windows.go @@ -78,13 +78,15 @@ const ( type windowState struct { // pendingTitle is the title SetTitle asked for, applied on the window thread. - pendingTitle titleRequest - pendingWatermark watermarkRequest - watermark *watermarkOverlay - pendingIcon iconRequest - decoration windowDecoration - fullscreen atomic.Bool - fullscreenChanging bool + pendingTitle titleRequest + pendingWatermark watermarkRequest + watermark *watermarkOverlay + pendingIcon iconRequest + decoration windowDecoration + fullscreen atomic.Bool + fullscreenChanging bool + // fullscreenSpan is whether the fullscreen window covers every monitor. + fullscreenSpan bool fullscreenStyle uint32 fullscreenPlacement windowPlacement backdropState @@ -540,7 +542,7 @@ func windowProc(window, kind, first, second uintptr) (result uintptr) { state.resizeClient(int(first&0xffff), int((first>>16)&0xffff)) return 0 case wmFullscreen: - state.setFullscreen(first != 0) + state.setFullscreen(first != fullscreenOff, first == fullscreenAllMonitors) return 0 case wmSetWatermark: state.applyWatermark() diff --git a/internal/reloadwire/canvas.go b/internal/reloadwire/canvas.go index d062eb908..28efc7e63 100644 --- a/internal/reloadwire/canvas.go +++ b/internal/reloadwire/canvas.go @@ -17,19 +17,20 @@ func CaptureCanvas(canvas *gfx.Canvas) CanvasSnapshot { hitTexts[index], _ = canvas.HitText(&hits[index]) } return CanvasSnapshot{ - Rectangles: append([]gfx.Rectangle(nil), canvas.Rectangles()...), - Triangles: append([]gfx.Triangle(nil), canvas.Triangles()...), - Shadows: append([]gfx.Shadow(nil), canvas.Shadows()...), - Images: append([]gfx.Image(nil), canvas.Images()...), - Texts: append([]gfx.Text(nil), canvas.Texts()...), - Runs: append([]gfx.TextRun(nil), canvas.AllTextRuns()...), - Hits: append([]gfx.Hit(nil), hits...), - HitTexts: hitTexts, - TrappedScope: canvas.TrappedFocusScope(), - EscapeTarget: canvas.EscapeTarget(), - InitialFocus: canvas.InitialFocus(), - Animating: canvas.Animating(), - FrameDelayMs: delayMs, + Rectangles: append([]gfx.Rectangle(nil), canvas.Rectangles()...), + Triangles: append([]gfx.Triangle(nil), canvas.Triangles()...), + Shadows: append([]gfx.Shadow(nil), canvas.Shadows()...), + Images: append([]gfx.Image(nil), canvas.Images()...), + Texts: append([]gfx.Text(nil), canvas.Texts()...), + Runs: append([]gfx.TextRun(nil), canvas.AllTextRuns()...), + Hits: append([]gfx.Hit(nil), hits...), + HitTexts: hitTexts, + TrappedScope: canvas.TrappedFocusScope(), + EscapeTarget: canvas.EscapeTarget(), + InitialFocus: canvas.InitialFocus(), + InitialFocusVisible: canvas.InitialFocusVisible(), + Animating: canvas.Animating(), + FrameDelayMs: delayMs, } } @@ -119,6 +120,7 @@ func ApplyCanvas(canvas *gfx.Canvas, snapshot CanvasSnapshot) { if index < len(snapshot.HitTexts) { text = snapshot.HitTexts[index] } + first := len(canvas.Hits()) canvas.HitWithOptions(hit.ID, hit.Bounds, hit.Label, gfx.HitOptions{ Role: hit.Role, Value: hit.Value, Hint: hit.Hint, Disabled: hit.Disabled, Checked: hit.Checked, Selected: hit.Selected, Expanded: hit.Expanded, @@ -126,6 +128,9 @@ func ApplyCanvas(canvas *gfx.Canvas, snapshot CanvasSnapshot) { TextBounds: text.Bounds, TextSize: text.Size, TextColor: text.Color, TextWeight: text.Weight, Placement: text.Placement, }) + if hits := canvas.Hits(); !hit.DialogFooter.IsZero() && len(hits) > first { + hits[first].DialogFooter = hit.DialogFooter + } } if !hit.Scope.IsZero() { canvas.PopFocusScope() @@ -136,7 +141,7 @@ func ApplyCanvas(canvas *gfx.Canvas, snapshot CanvasSnapshot) { } canvas.TrapFocus(snapshot.TrappedScope) canvas.SetEscapeTarget(snapshot.EscapeTarget) - canvas.SetInitialFocus(snapshot.InitialFocus) + canvas.SetInitialFocusWithVisibility(snapshot.InitialFocus, snapshot.InitialFocusVisible) if snapshot.Animating { canvas.RequestFrame() } else if snapshot.FrameDelayMs > 0 { diff --git a/internal/reloadwire/codec.go b/internal/reloadwire/codec.go index ad42907a4..99c1563d3 100644 --- a/internal/reloadwire/codec.go +++ b/internal/reloadwire/codec.go @@ -9,7 +9,7 @@ import ( ) const ( - ProtocolVersion = 31 + ProtocolVersion = 32 MaxFrameBytes = 32 << 20 MaxStateBytes = 8 << 20 maxItems = 200_000 @@ -101,10 +101,11 @@ type CanvasSnapshot struct { Hits []gfx.Hit // HitTexts is dense: one entry per Hits entry, zero for a hit that // declared no text geometry. Placement is not carried across the wire. - HitTexts []gfx.HitText - TrappedScope gfx.ID - EscapeTarget gfx.ID - InitialFocus gfx.ID + HitTexts []gfx.HitText + TrappedScope gfx.ID + EscapeTarget gfx.ID + InitialFocus gfx.ID + InitialFocusVisible bool // Animating reports that a transition was still in flight, so the host // must schedule another frame. Animating bool @@ -592,6 +593,7 @@ func encodeCanvas(value CanvasSnapshot) ([]byte, error) { result.string(hit.Value) result.string(hit.Hint) result.id(hit.Scope) + result.id(hit.DialogFooter) result.u16(hit.Layer) result.u8(uint8(hit.Role)) result.bool(hit.Disabled) @@ -615,6 +617,7 @@ func encodeCanvas(value CanvasSnapshot) ([]byte, error) { result.id(value.TrappedScope) result.id(value.EscapeTarget) result.id(value.InitialFocus) + result.bool(value.InitialFocusVisible) result.bool(value.Animating) result.u32(value.FrameDelayMs) return result.data, result.err @@ -735,7 +738,7 @@ func decodeCanvas(data []byte) (CanvasSnapshot, error) { for index := range result.Hits { result.Hits[index] = gfx.Hit{ ID: value.id(), Bounds: decodeRect(&value), Label: value.string(), Value: value.string(), Hint: value.string(), - Scope: value.id(), Layer: value.u16(), Role: gfx.Role(value.u8()), Disabled: value.bool(), Checked: value.bool(), + Scope: value.id(), DialogFooter: value.id(), Layer: value.u16(), Role: gfx.Role(value.u8()), Disabled: value.bool(), Checked: value.bool(), Selected: value.bool(), Expanded: value.bool(), Multiline: value.bool(), ReadOnly: value.bool(), Invalid: value.bool(), Secure: value.bool(), Focusable: value.bool(), Autofocus: value.bool(), Block: value.bool(), BlockSurface: value.bool(), MovesWindow: value.bool(), } result.HitTexts[index] = gfx.HitText{ @@ -745,6 +748,7 @@ func decodeCanvas(data []byte) (CanvasSnapshot, error) { result.TrappedScope = value.id() result.EscapeTarget = value.id() result.InitialFocus = value.id() + result.InitialFocusVisible = value.bool() result.Animating = value.bool() result.FrameDelayMs = value.u32() return result, value.finish() diff --git a/internal/reloadwire/reloadwire_test.go b/internal/reloadwire/reloadwire_test.go index d54a86108..92000d221 100644 --- a/internal/reloadwire/reloadwire_test.go +++ b/internal/reloadwire/reloadwire_test.go @@ -55,11 +55,15 @@ func TestCanvasCodecPreservesRetainedOutput(t *testing.T) { TextSize: 12, TextWeight: 600, TextColor: gfx.Color{Red: 0.9, Green: 0.8, Blue: 0.7, Alpha: 1}, }) canvas.HitWithOptions(gfx.Item(12), gfx.Rect{X: 4, Y: 110, Width: 120, Height: 30}, "Terminal", gfx.HitOptions{Role: gfx.RoleTerminal, Autofocus: true}) + footer := canvas.Mark() + canvas.HitWithLabel(gfx.Item(13), gfx.Rect{Y: 150, Width: 60, Height: 30}, "Cancel") + canvas.HitWithLabel(gfx.Item(14), gfx.Rect{X: 70, Y: 150, Width: 60, Height: 30}, "Save") + canvas.DialogFooter(footer) canvas.PopFocusScope() canvas.PopLayer() canvas.TrapFocus(gfx.Item(44)) canvas.SetEscapeTarget(gfx.Item(9)) - canvas.SetInitialFocus(gfx.Item(9)) + canvas.SetInitialFocusWithVisibility(gfx.Item(9), true) want := CaptureCanvas(&canvas) data, err := encodeCanvas(want) diff --git a/style/button.go b/style/button.go index 5abcf42d2..d45159db3 100644 --- a/style/button.go +++ b/style/button.go @@ -11,6 +11,11 @@ const ( ButtonIconInset = 8 ) +// DialogButtonMinWidth is the narrowest a button in a dialog footer is. A label of two +// CJK characters or a short Latin one would otherwise leave the button taller than it is +// wide; desktop dialogs give their buttons a minimum width for the same reason. +const DialogButtonMinWidth = 64 + // ButtonIconExtent is the side of the icon square in a button height tall. func ButtonIconExtent(height float32) float32 { return max(0, min(float32(ButtonIconSize), height-ButtonIconInset)) diff --git a/tools/visualparity/testdata/layout.json b/tools/visualparity/testdata/layout.json index d3e54eac4..047bb780f 100644 --- a/tools/visualparity/testdata/layout.json +++ b/tools/visualparity/testdata/layout.json @@ -1 +1 @@ -{"baseline":{"scene":"baseline","platform":"","width":760,"height":700,"dark":false,"texts":[{"value":"HHHH","bounds":{"X":12,"Y":12,"W":110,"H":18},"size":11,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":31.39},{"value":"xxxx","bounds":{"X":130,"Y":12,"W":110,"H":18},"size":11,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":23.05},{"value":"Hpgy","bounds":{"X":248,"Y":12,"W":110,"H":18},"size":11,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":26.73},{"value":"HHHH","bounds":{"X":366,"Y":14.5,"W":110,"H":13},"size":11,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":34,"W":110,"H":18},"size":11,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":31.45},{"value":"xxxx","bounds":{"X":130,"Y":34,"W":110,"H":18},"size":11,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":23.53},{"value":"Hpgy","bounds":{"X":248,"Y":34,"W":110,"H":18},"size":11,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":27.01},{"value":"HHHH","bounds":{"X":366,"Y":36.5,"W":110,"H":13},"size":11,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":56,"W":110,"H":18},"size":11,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":31.5},{"value":"xxxx","bounds":{"X":130,"Y":56,"W":110,"H":18},"size":11,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":24.02},{"value":"Hpgy","bounds":{"X":248,"Y":56,"W":110,"H":18},"size":11,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":27.29},{"value":"HHHH","bounds":{"X":366,"Y":58.5,"W":110,"H":13},"size":11,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":78,"W":110,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.24},{"value":"xxxx","bounds":{"X":130,"Y":78,"W":110,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":25.15},{"value":"Hpgy","bounds":{"X":248,"Y":78,"W":110,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.16},{"value":"HHHH","bounds":{"X":366,"Y":80,"W":110,"H":15},"size":12,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":101,"W":110,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.31},{"value":"xxxx","bounds":{"X":130,"Y":101,"W":110,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":25.66},{"value":"Hpgy","bounds":{"X":248,"Y":101,"W":110,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.46},{"value":"HHHH","bounds":{"X":366,"Y":103,"W":110,"H":15},"size":12,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":124,"W":110,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.36},{"value":"xxxx","bounds":{"X":130,"Y":124,"W":110,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":26.2},{"value":"Hpgy","bounds":{"X":248,"Y":124,"W":110,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.77},{"value":"HHHH","bounds":{"X":366,"Y":126,"W":110,"H":15},"size":12,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":147,"W":110,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":37.1},{"value":"xxxx","bounds":{"X":130,"Y":147,"W":110,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":27.24},{"value":"Hpgy","bounds":{"X":248,"Y":147,"W":110,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":31.59},{"value":"HHHH","bounds":{"X":366,"Y":149,"W":110,"H":16},"size":13,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":171,"W":110,"H":20},"size":13,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":37.17},{"value":"xxxx","bounds":{"X":130,"Y":171,"W":110,"H":20},"size":13,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":27.8},{"value":"Hpgy","bounds":{"X":248,"Y":171,"W":110,"H":20},"size":13,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":31.92},{"value":"HHHH","bounds":{"X":366,"Y":173,"W":110,"H":16},"size":13,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":195,"W":110,"H":20},"size":13,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":37.22},{"value":"xxxx","bounds":{"X":130,"Y":195,"W":110,"H":20},"size":13,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":28.39},{"value":"Hpgy","bounds":{"X":248,"Y":195,"W":110,"H":20},"size":13,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":32.25},{"value":"HHHH","bounds":{"X":366,"Y":197,"W":110,"H":16},"size":13,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":219,"W":110,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":39.95},{"value":"xxxx","bounds":{"X":130,"Y":219,"W":110,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.34},{"value":"Hpgy","bounds":{"X":248,"Y":219,"W":110,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.02},{"value":"HHHH","bounds":{"X":366,"Y":221,"W":110,"H":17},"size":14,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":244,"W":110,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":40.03},{"value":"xxxx","bounds":{"X":130,"Y":244,"W":110,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.94},{"value":"Hpgy","bounds":{"X":248,"Y":244,"W":110,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.37},{"value":"HHHH","bounds":{"X":366,"Y":246,"W":110,"H":17},"size":14,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":269,"W":110,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":40.09},{"value":"xxxx","bounds":{"X":130,"Y":269,"W":110,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":30.57},{"value":"Hpgy","bounds":{"X":248,"Y":269,"W":110,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.73},{"value":"HHHH","bounds":{"X":366,"Y":271,"W":110,"H":17},"size":14,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":294,"W":110,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":45.66},{"value":"xxxx","bounds":{"X":130,"Y":294,"W":110,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":33.53},{"value":"Hpgy","bounds":{"X":248,"Y":294,"W":110,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":38.88},{"value":"HHHH","bounds":{"X":366,"Y":296,"W":110,"H":19},"size":16,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":321,"W":110,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":45.75},{"value":"xxxx","bounds":{"X":130,"Y":321,"W":110,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.22},{"value":"Hpgy","bounds":{"X":248,"Y":321,"W":110,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":39.28},{"value":"HHHH","bounds":{"X":366,"Y":323,"W":110,"H":19},"size":16,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":348,"W":110,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":45.81},{"value":"xxxx","bounds":{"X":130,"Y":348,"W":110,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.94},{"value":"Hpgy","bounds":{"X":248,"Y":348,"W":110,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":39.69},{"value":"HHHH","bounds":{"X":366,"Y":350,"W":110,"H":19},"size":16,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":375,"W":110,"H":25},"size":18,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":51.36},{"value":"xxxx","bounds":{"X":130,"Y":375,"W":110,"H":25},"size":18,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":37.72},{"value":"Hpgy","bounds":{"X":248,"Y":375,"W":110,"H":25},"size":18,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":43.73},{"value":"HHHH","bounds":{"X":366,"Y":376.5,"W":110,"H":22},"size":18,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":404,"W":110,"H":25},"size":18,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":51.47},{"value":"xxxx","bounds":{"X":130,"Y":404,"W":110,"H":25},"size":18,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":38.5},{"value":"Hpgy","bounds":{"X":248,"Y":404,"W":110,"H":25},"size":18,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":44.19},{"value":"HHHH","bounds":{"X":366,"Y":405.5,"W":110,"H":22},"size":18,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":433,"W":110,"H":25},"size":18,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":51.54},{"value":"xxxx","bounds":{"X":130,"Y":433,"W":110,"H":25},"size":18,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":39.3},{"value":"Hpgy","bounds":{"X":248,"Y":433,"W":110,"H":25},"size":18,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":44.65},{"value":"HHHH","bounds":{"X":366,"Y":434.5,"W":110,"H":22},"size":18,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":462,"W":110,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":57.07},{"value":"xxxx","bounds":{"X":130,"Y":462,"W":110,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":41.91},{"value":"Hpgy","bounds":{"X":248,"Y":462,"W":110,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":48.59},{"value":"HHHH","bounds":{"X":366,"Y":463.5,"W":110,"H":24},"size":20,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":493,"W":110,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":57.19},{"value":"xxxx","bounds":{"X":130,"Y":493,"W":110,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":42.77},{"value":"Hpgy","bounds":{"X":248,"Y":493,"W":110,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":49.1},{"value":"HHHH","bounds":{"X":366,"Y":494.5,"W":110,"H":24},"size":20,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":524,"W":110,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":57.27},{"value":"xxxx","bounds":{"X":130,"Y":524,"W":110,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":43.67},{"value":"Hpgy","bounds":{"X":248,"Y":524,"W":110,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":49.61},{"value":"HHHH","bounds":{"X":366,"Y":525.5,"W":110,"H":24},"size":20,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":555,"W":110,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":68.48},{"value":"xxxx","bounds":{"X":130,"Y":555,"W":110,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":50.3},{"value":"Hpgy","bounds":{"X":248,"Y":555,"W":110,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":58.31},{"value":"HHHH","bounds":{"X":366,"Y":556,"W":110,"H":29},"size":24,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":590,"W":110,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":68.63},{"value":"xxxx","bounds":{"X":130,"Y":590,"W":110,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":51.33},{"value":"Hpgy","bounds":{"X":248,"Y":590,"W":110,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":58.92},{"value":"HHHH","bounds":{"X":366,"Y":591,"W":110,"H":29},"size":24,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":625,"W":110,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":68.72},{"value":"xxxx","bounds":{"X":130,"Y":625,"W":110,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":52.41},{"value":"Hpgy","bounds":{"X":248,"Y":625,"W":110,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":59.53},{"value":"HHHH","bounds":{"X":366,"Y":626,"W":110,"H":29},"size":24,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0}],"rectangles":null,"triangles":null,"hits":null},"cards":{"scene":"cards","platform":"","width":560,"height":460,"dark":false,"texts":[{"value":"Card title","bounds":{"X":41,"Y":41,"W":478,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":59.21},{"value":"Card body in muted text.","bounds":{"X":41,"Y":70,"W":478,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":157.06}],"rectangles":[{"bounds":{"X":24,"Y":24,"W":512,"H":84},"radius":11,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":25,"W":510,"H":82},"radius":10,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":124,"W":64,"H":64},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":125,"W":62,"H":62},"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":100,"Y":124,"W":64,"H":64},"radius":2,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":101,"Y":125,"W":62,"H":62},"radius":1,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":176,"Y":124,"W":64,"H":64},"radius":4,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":177,"Y":125,"W":62,"H":62},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":252,"Y":124,"W":64,"H":64},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":253,"Y":125,"W":62,"H":62},"radius":6.5,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":328,"Y":124,"W":64,"H":64},"radius":11,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":329,"Y":125,"W":62,"H":62},"radius":10,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":404,"Y":124,"W":64,"H":64},"radius":16,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":405,"Y":125,"W":62,"H":62},"radius":15,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":204,"W":64,"H":48},"radius":10,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":25,"Y":205,"W":62,"H":46},"radius":9,"color":[1,1,1,1]},{"bounds":{"X":100,"Y":204,"W":64,"H":48},"radius":10,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":101,"Y":205,"W":62,"H":46},"radius":9,"color":[1,1,1,1]},{"bounds":{"X":176,"Y":204,"W":64,"H":48},"radius":10,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":177,"Y":205,"W":62,"H":46},"radius":9,"color":[1,1,1,1]},{"bounds":{"X":252,"Y":204,"W":64,"H":48},"radius":10,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":254,"Y":206,"W":60,"H":44},"radius":8,"color":[1,1,1,1]},{"bounds":{"X":328,"Y":204,"W":64,"H":48},"radius":10,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":331,"Y":207,"W":58,"H":42},"radius":7,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":268,"W":17,"H":17},"radius":8.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":53,"Y":268,"W":33,"H":33},"radius":16.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":98,"Y":268,"W":41,"H":41},"radius":20.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":151,"Y":268,"W":63,"H":63},"radius":31.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":226,"Y":268,"W":120,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":358,"Y":268,"W":121,"H":33},"radius":5,"color":[0.9607843,0.9607843,0.9607843,1]}],"triangles":null,"hits":null},"dialog":{"scene":"dialog","platform":"","width":640,"height":420,"dark":false,"texts":[{"value":"Hosts","bounds":{"X":24,"Y":24,"W":592,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":64.65},{"value":"A page behind a dialog, dimmed by the scrim.","bounds":{"X":24,"Y":67,"W":592,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":290.6},{"value":"New host","bounds":{"X":34,"Y":100,"W":80.81,"H":32},"size":14,"weight":0.15,"color":[0.9372549,0.9647059,1,1],"canvasWidth":60.81},{"value":"Import","bounds":{"X":122.81,"Y":100,"W":61.79,"H":32},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":41.79},{"value":"Delete host?","bounds":{"X":144,"Y":126,"W":352,"H":17},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"layer":12,"canvasWidth":91.47},{"value":"This removes the saved connection. It cannot be","bounds":{"X":144,"Y":151,"W":352,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"layer":12,"canvasWidth":309.37},{"value":"undone.","bounds":{"X":144,"Y":172,"W":352,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"layer":12,"canvasWidth":51.83},{"value":"web-01 (10.0.0.12)","bounds":{"X":144,"Y":217,"W":352,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"layer":12,"canvasWidth":116.94},{"value":"Cancel","bounds":{"X":372.04,"Y":262,"W":64.61,"H":32},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"layer":12,"canvasWidth":44.61},{"value":"Delete","bounds":{"X":444.66,"Y":262,"W":61.34,"H":32},"size":14,"weight":0.15,"color":[0.90588236,0,0.043137256,1],"layer":12,"canvasWidth":41.34}],"rectangles":[{"bounds":{"X":24,"Y":100,"W":81,"H":32},"radius":7.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":113,"Y":100,"W":62,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":114,"Y":101,"W":60,"H":30},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":0,"Y":0,"W":640,"H":420},"color":[0,0,0,0.4],"layer":12},{"bounds":{"X":120,"Y":102,"W":400,"H":216},"radius":11,"color":[0.8980392,0.8980392,0.8980392,1],"layer":12},{"bounds":{"X":121,"Y":103,"W":398,"H":214},"radius":10,"color":[1,1,1,1],"layer":12},{"bounds":{"X":472,"Y":118,"W":32,"H":32},"radius":7.5,"color":[1,1,1,0],"layer":12},{"bounds":{"X":362,"Y":262,"W":65,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1],"layer":12},{"bounds":{"X":363,"Y":263,"W":63,"H":30},"radius":6.5,"color":[1,1,1,1],"layer":12},{"bounds":{"X":435,"Y":262,"W":61,"H":32},"radius":7.5,"color":[0.90588236,0,0.043137256,0.1],"layer":12}],"triangles":[{"points":[[491.47,129.47],[483.47,137.47],[492.53,130.53]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492.53,130.53],[483.47,137.47],[484.53,138.53]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492.75,130],[492.65,130.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492.65,130.38],[492.38,130.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492.38,130.65],[492,130.75]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492,130.75],[491.63,130.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[491.63,130.65],[491.35,130.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[491.35,130.38],[491.25,130]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[491.25,130],[491.35,129.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[491.35,129.63],[491.63,129.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[491.63,129.35],[492,129.25]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492,129.25],[492.38,129.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492.38,129.35],[492.65,129.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492.65,129.63],[492.75,130]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484.75,138],[484.65,138.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484.65,138.38],[484.38,138.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484.38,138.65],[484,138.75]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484,138.75],[483.63,138.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[483.63,138.65],[483.35,138.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[483.35,138.38],[483.25,138]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[483.25,138],[483.35,137.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[483.35,137.63],[483.63,137.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[483.63,137.35],[484,137.25]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484,137.25],[484.38,137.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484.38,137.35],[484.65,137.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484.65,137.63],[484.75,138]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[483.47,130.53],[491.47,138.53],[484.53,129.47]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484.53,129.47],[491.47,138.53],[492.53,137.47]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484.75,130],[484.65,130.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484.65,130.38],[484.38,130.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484.38,130.65],[484,130.75]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484,130.75],[483.63,130.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[483.63,130.65],[483.35,130.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[483.35,130.38],[483.25,130]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[483.25,130],[483.35,129.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[483.35,129.63],[483.63,129.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[483.63,129.35],[484,129.25]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484,129.25],[484.38,129.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484.38,129.35],[484.65,129.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484.65,129.63],[484.75,130]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492.75,138],[492.65,138.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492.65,138.38],[492.38,138.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492.38,138.65],[492,138.75]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492,138.75],[491.63,138.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[491.63,138.65],[491.35,138.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[491.35,138.38],[491.25,138]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[491.25,138],[491.35,137.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[491.35,137.63],[491.63,137.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[491.63,137.35],[492,137.25]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492,137.25],[492.38,137.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492.38,137.35],[492.65,137.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492.65,137.63],[492.75,138]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12}],"shadows":[{"bounds":{"X":113,"Y":100,"W":62,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":362,"Y":262,"W":65,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2,"layer":12}],"hits":[{"id":"parity/#0/#0/#16777216","bounds":{"X":24,"Y":100,"W":80.81,"H":32},"label":"New host","role":1},{"id":"parity/#0/#0/#16777217","bounds":{"X":112.81,"Y":100,"W":61.79,"H":32},"label":"Import","role":1},{"id":"parity/dismiss","bounds":{"X":0,"Y":0,"W":640,"H":420},"label":"Dismiss dialog","role":1,"layer":12},{"id":"none","bounds":{"X":120,"Y":102,"W":400,"H":216},"layer":12},{"id":"parity/close","bounds":{"X":472,"Y":118,"W":32,"H":32},"label":"Close dialog","role":1,"layer":12},{"id":"parity/#16777216","bounds":{"X":362.04,"Y":262,"W":64.61,"H":32},"label":"Cancel","role":1,"layer":12},{"id":"parity/#16777217","bounds":{"X":434.66,"Y":262,"W":61.34,"H":32},"label":"Delete","role":1,"layer":12}]},"form":{"scene":"form","platform":"","width":560,"height":640,"dark":false,"texts":[{"value":"New connection","bounds":{"X":24,"Y":24,"W":512,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":181.24},{"value":"Connect to a server over SSH with a key or a password.","bounds":{"X":24,"Y":69,"W":512,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":355.18},{"value":"Connect","bounds":{"X":34,"Y":104,"W":74.38,"H":32},"size":14,"weight":0.15,"color":[0.9372549,0.9647059,1,1],"canvasWidth":54.38},{"value":"Save","bounds":{"X":116.38,"Y":104,"W":51.93,"H":32},"size":14,"weight":0.15,"color":[0.09411765,0.09411765,0.105882354,1],"canvasWidth":31.93},{"value":"Cancel","bounds":{"X":176.31,"Y":104,"W":64.61,"H":32},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":44.61},{"value":"Help","bounds":{"X":248.92,"Y":104,"W":49.59,"H":32},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.59},{"value":"Delete","bounds":{"X":306.51,"Y":104,"W":61.34,"H":32},"size":14,"weight":0.15,"color":[0.90588236,0,0.043137256,1],"canvasWidth":41.34},{"value":"Small","bounds":{"X":34,"Y":154,"W":55.01,"H":28},"size":14,"weight":0.15,"color":[0.9372549,0.9647059,1,1],"canvasWidth":35.01},{"value":"Default","bounds":{"X":97.01,"Y":152,"W":66.37,"H":32},"size":14,"weight":0.15,"color":[0.9372549,0.9647059,1,1],"canvasWidth":46.37},{"value":"Large","bounds":{"X":171.38,"Y":150,"W":56.65,"H":36},"size":14,"weight":0.15,"color":[0.9372549,0.9647059,1,1],"canvasWidth":36.65},{"value":"Keep alive","bounds":{"X":88,"Y":206.7,"W":49.33,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":88,"Y":206.7,"W":49.329086,"H":21},"canvasWidth":66.15},{"value":"Compression","bounds":{"X":225.33,"Y":206.7,"W":65.06,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":225.32909,"Y":206.7,"W":65.06122,"H":21},"canvasWidth":84.22},{"value":"Agent forwarding","bounds":{"X":362.39,"Y":206.7,"W":90.31,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":362.39032,"Y":206.7,"W":90.30783,"H":21},"canvasWidth":110.84},{"value":"X11","bounds":{"X":524.7,"Y":206.7,"W":11.3,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":524.6981,"Y":206.7,"W":11.301872,"H":21},"canvasWidth":20.1},{"value":"Ada Lovelace","bounds":{"X":35,"Y":254.4,"W":490,"H":20},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":35,"Y":248.4,"W":490,"H":32},"canvasWidth":86.19},{"value":"hostname or address","bounds":{"X":35,"Y":300.4,"W":490,"H":20},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"clip":{"X":35,"Y":294.4,"W":490,"H":32},"canvasWidth":134.37},{"value":"Password","bounds":{"X":77.59,"Y":340.4,"W":170.67,"H":32},"size":14,"weight":0.15,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":63.49},{"value":"Key","bounds":{"X":267.57,"Y":340.4,"W":170.67,"H":32},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":24.87},{"value":"Agent","bounds":{"X":431.46,"Y":340.4,"W":170.67,"H":32},"size":14,"weight":0.15,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":38.41},{"value":"OpenSSH","bounds":{"X":35,"Y":386.4,"W":178,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":61.51}],"rectangles":[{"bounds":{"X":24,"Y":104,"W":74,"H":32},"radius":7.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":106,"Y":104,"W":52,"H":32},"radius":7.5,"color":[0.95686275,0.95686275,0.9607843,1]},{"bounds":{"X":166,"Y":104,"W":65,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":167,"Y":105,"W":63,"H":30},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":297,"Y":104,"W":61,"H":32},"radius":7.5,"color":[0.90588236,0,0.043137256,0.1]},{"bounds":{"X":24,"Y":154,"W":55,"H":28},"radius":7.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":87,"Y":152,"W":66,"H":32},"radius":7.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":161,"Y":150,"W":57,"H":36},"radius":7.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":36,"Y":208,"W":32,"H":18},"radius":9.2,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":51,"Y":209,"W":16,"H":16},"radius":8,"color":[1,1,1,1]},{"bounds":{"X":173,"Y":208,"W":32,"H":18},"radius":9.2,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":174,"Y":209,"W":16,"H":16},"radius":8,"color":[1,1,1,1]},{"bounds":{"X":326,"Y":209,"W":16,"H":16},"radius":4,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":327,"Y":210,"W":14,"H":14},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":489,"Y":209,"W":16,"H":16},"radius":4,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":490,"Y":210,"W":14,"H":14},"radius":3,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":248,"W":512,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":249,"W":510,"H":30},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":294,"W":512,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":295,"W":510,"H":30},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":340,"W":512,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":341,"W":510,"H":30},"radius":6.5,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":26,"Y":342,"W":167,"H":28},"radius":5.5,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":197,"Y":342,"W":167,"H":28},"radius":5.5,"color":[1,1,1,1]},{"bounds":{"X":367,"Y":342,"W":167,"H":28},"radius":5.5,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":194,"Y":349,"W":1,"H":14},"color":[0.8980392,0.8980392,0.8980392,0]},{"bounds":{"X":365,"Y":349,"W":1,"H":14},"color":[0.8980392,0.8980392,0.8980392,0]},{"bounds":{"X":24,"Y":386,"W":220,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":387,"W":218,"H":30},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":437,"W":512,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":437,"W":182,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":198,"Y":432,"W":16,"H":16},"radius":8,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":199,"Y":433,"W":14,"H":14},"radius":7,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":462,"W":512,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":462,"W":512,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1],"clip":{"X":24,"Y":462.4,"W":307.2,"H":6}}],"triangles":[{"points":[[338.14,213.26],[331.72,219.68],[339.2,214.32]],"color":[0.9372549,0.9647059,1,1]},{"points":[[339.2,214.32],[331.72,219.68],[332.78,220.74]],"color":[0.9372549,0.9647059,1,1]},{"points":[[332.78,219.68],[329.86,216.76],[331.72,220.74]],"color":[0.9372549,0.9647059,1,1]},{"points":[[331.72,220.74],[329.86,216.76],[328.8,217.82]],"color":[0.9372549,0.9647059,1,1]},{"points":[[332.25,220.21],[332.78,220.74],[332.25,220.96]],"color":[0.9372549,0.9647059,1,1]},{"points":[[332.25,220.21],[332.25,220.96],[331.72,220.74]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[339.42,213.79],[339.32,214.17]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[339.32,214.17],[339.04,214.44]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[339.04,214.44],[338.67,214.54]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[338.67,214.54],[338.29,214.44]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[338.29,214.44],[338.02,214.17]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[338.02,214.17],[337.92,213.79]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[337.92,213.79],[338.02,213.42]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[338.02,213.42],[338.29,213.14]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[338.29,213.14],[338.67,213.04]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[338.67,213.04],[339.04,213.14]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[339.04,213.14],[339.32,213.42]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[339.32,213.42],[339.42,213.79]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[330.08,217.29],[329.98,217.67]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[329.98,217.67],[329.71,217.94]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[329.71,217.94],[329.33,218.04]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[329.33,218.04],[328.96,217.94]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[328.96,217.94],[328.68,217.67]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[328.68,217.67],[328.58,217.29]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[328.58,217.29],[328.68,216.92]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[328.68,216.92],[328.96,216.64]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[328.96,216.64],[329.33,216.54]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[329.33,216.54],[329.71,216.64]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[329.71,216.64],[329.98,216.92]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[329.98,216.92],[330.08,217.29]],"color":[0.9372549,0.9647059,1,1]},{"points":[[222.47,400.53],[226.47,404.53],[223.53,399.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223.53,399.47],[226.47,404.53],[227.53,403.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[227.53,404.53],[231.53,400.53],[226.47,403.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[226.47,403.47],[231.53,400.53],[230.47,399.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[227,404],[226.47,404.53],[227,404.75]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[227,404],[227,404.75],[227.53,404.53]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223.75,400],[223.65,400.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223.65,400.38],[223.38,400.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223.38,400.65],[223,400.75]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223,400.75],[222.63,400.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[222.63,400.65],[222.35,400.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[222.35,400.38],[222.25,400]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[222.25,400],[222.35,399.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[222.35,399.63],[222.63,399.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[222.63,399.35],[223,399.25]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223,399.25],[223.38,399.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223.38,399.35],[223.65,399.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223.65,399.63],[223.75,400]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231.75,400],[231.65,400.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231.65,400.38],[231.38,400.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231.38,400.65],[231,400.75]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231,400.75],[230.63,400.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[230.63,400.65],[230.35,400.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[230.35,400.38],[230.25,400]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[230.25,400],[230.35,399.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[230.35,399.63],[230.63,399.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[230.63,399.35],[231,399.25]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231,399.25],[231.38,399.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231.38,399.35],[231.65,399.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231.65,399.63],[231.75,400]],"color":[0.4509804,0.4509804,0.4509804,1]}],"shadows":[{"bounds":{"X":166,"Y":104,"W":65,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":36,"Y":208,"W":32,"H":18},"radius":9.2,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":173,"Y":208,"W":32,"H":18},"radius":9.2,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":326,"Y":209,"W":16,"H":16},"radius":4,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":489,"Y":209,"W":16,"H":16},"radius":4,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":24,"Y":248,"W":512,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":24,"Y":294,"W":512,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":24,"Y":386,"W":220,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":198,"Y":432,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":198,"Y":432,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1}],"hits":[{"id":"parity/#0/#0/#16777216","bounds":{"X":24,"Y":104,"W":74.38,"H":32},"label":"Connect","role":1},{"id":"parity/#0/#0/#16777217","bounds":{"X":106.38,"Y":104,"W":51.93,"H":32},"label":"Save","role":1},{"id":"parity/#0/#0/#16777218","bounds":{"X":166.31,"Y":104,"W":64.61,"H":32},"label":"Cancel","role":1},{"id":"parity/#0/#0/#16777219","bounds":{"X":238.92,"Y":104,"W":49.59,"H":32},"label":"Help","role":1},{"id":"parity/#0/#0/#16777220","bounds":{"X":296.51,"Y":104,"W":61.34,"H":32},"label":"Delete","role":1},{"id":"parity/#0/#1/#16777216","bounds":{"X":24,"Y":154,"W":55.01,"H":28},"label":"Small","role":1},{"id":"parity/#0/#1/#16777217","bounds":{"X":87.01,"Y":152,"W":66.37,"H":32},"label":"Default","role":1},{"id":"parity/#0/#1/#16777218","bounds":{"X":161.38,"Y":150,"W":56.65,"H":36},"label":"Large","role":1},{"id":"parity/#0/#2/#0/#50331648","bounds":{"X":24,"Y":200,"W":56,"H":34.4},"label":"switch","role":8},{"id":"parity/#0/#2/#1/#50331648","bounds":{"X":161.33,"Y":200,"W":56,"H":34.4},"label":"switch","role":8},{"id":"parity/#0/#2/#2/#33554432","bounds":{"X":314.39,"Y":201.2,"W":40,"H":32},"label":"checkbox","role":3},{"id":"parity/#0/#2/#3/#33554432","bounds":{"X":476.7,"Y":201.2,"W":40,"H":32},"label":"checkbox","role":3},{"id":"parity/#0/#83886080","bounds":{"X":24,"Y":248.4,"W":512,"H":32},"label":"Name","role":9},{"id":"parity/#0/#83886081","bounds":{"X":24,"Y":294.4,"W":512,"H":32},"label":"Host","role":9},{"id":"parity/#0/#67108864/#0","bounds":{"X":24,"Y":340.4,"W":170.67,"H":32},"label":"Password","role":4},{"id":"parity/#0/#67108864/#1","bounds":{"X":194.67,"Y":340.4,"W":170.67,"H":32},"label":"Key","role":4},{"id":"parity/#0/#67108864/#2","bounds":{"X":365.33,"Y":340.4,"W":170.67,"H":32},"label":"Agent","role":4},{"id":"parity/#0/#167772160/#3","bounds":{"X":24,"Y":386.4,"W":220,"H":32},"label":"Client","role":7},{"id":"parity/#0/#184549376","bounds":{"X":24,"Y":432.4,"W":512,"H":16},"label":"Slider","role":10}]},"list-clip":{"scene":"list-clip","platform":"","width":360,"height":300,"dark":false,"texts":[{"value":"Recent","bounds":{"X":24,"Y":24,"W":312,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":45.47},{"value":"session-00.log","bounds":{"X":57,"Y":29,"W":94.94,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.94},{"value":"session-01.log","bounds":{"X":57,"Y":66,"W":91.93,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":91.93},{"value":"session-02.log","bounds":{"X":57,"Y":103,"W":94.66,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.66},{"value":"session-03.log","bounds":{"X":57,"Y":140,"W":94.76,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.76},{"value":"session-04.log","bounds":{"X":57,"Y":177,"W":95.14,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":95.14},{"value":"session-05.log","bounds":{"X":57,"Y":214,"W":94.63,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.63},{"value":"session-06.log","bounds":{"X":57,"Y":251,"W":94.79,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.79},{"value":"session-07.log","bounds":{"X":57,"Y":288,"W":94.07,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.07},{"value":"session-08.log","bounds":{"X":57,"Y":325,"W":94.77,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.77}],"rectangles":[{"bounds":{"X":24,"Y":57,"W":312,"H":180},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":25,"Y":58,"W":310,"H":178},"radius":6.5,"color":[1,1,1,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":32,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":69,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":106,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":143,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":180,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":217,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":254,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":291,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":328,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}}],"triangles":null,"hits":null},"progress-slider":{"scene":"progress-slider","platform":"","width":480,"height":420,"dark":false,"texts":null,"rectangles":[{"bounds":{"X":24,"Y":24,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":44,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":44,"W":432,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1],"clip":{"X":24,"Y":44,"W":142.56001,"H":6}},{"bounds":{"X":24,"Y":64,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":64,"W":432,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1],"clip":{"X":24,"Y":64,"W":285.12003,"H":6}},{"bounds":{"X":24,"Y":84,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":84,"W":432,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1],"clip":{"X":24,"Y":84,"W":432,"H":6}},{"bounds":{"X":24,"Y":109,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":109,"W":8,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":24,"Y":104,"W":16,"H":16},"radius":8,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":25,"Y":105,"W":14,"H":14},"radius":7,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":139,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":139,"W":112,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":128,"Y":134,"W":16,"H":16},"radius":8,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":129,"Y":135,"W":14,"H":14},"radius":7,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":169,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":169,"W":216,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":232,"Y":164,"W":16,"H":16},"radius":8,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":233,"Y":165,"W":14,"H":14},"radius":7,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":199,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":199,"W":432,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":440,"Y":194,"W":16,"H":16},"radius":8,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":441,"Y":195,"W":14,"H":14},"radius":7,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":224,"W":432,"H":12},"radius":6,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":224,"W":432,"H":12},"radius":6,"color":[0.078431375,0.2784314,0.9019608,1],"clip":{"X":24,"Y":224,"W":216,"H":12}},{"bounds":{"X":29,"Y":250,"W":6,"H":120},"radius":60,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":29,"Y":320,"W":6,"H":50},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":24,"Y":312,"W":16,"H":16},"radius":8,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":25,"Y":313,"W":14,"H":14},"radius":7,"color":[1,1,1,1]}],"triangles":null,"shadows":[{"bounds":{"X":24,"Y":104,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":24,"Y":104,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1},{"bounds":{"X":128,"Y":134,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":128,"Y":134,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1},{"bounds":{"X":232,"Y":164,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":232,"Y":164,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1},{"bounds":{"X":440,"Y":194,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":440,"Y":194,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1},{"bounds":{"X":24,"Y":312,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":24,"Y":312,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1}],"hits":[{"id":"parity/#0/#184549376","bounds":{"X":24,"Y":104,"W":432,"H":16},"label":"Slider","role":10},{"id":"parity/#0/#184549377","bounds":{"X":24,"Y":134,"W":432,"H":16},"label":"Slider","role":10},{"id":"parity/#0/#184549378","bounds":{"X":24,"Y":164,"W":432,"H":16},"label":"Slider","role":10},{"id":"parity/#0/#184549379","bounds":{"X":24,"Y":194,"W":432,"H":16},"label":"Slider","role":10},{"id":"parity/#0/#0/#184549376","bounds":{"X":24,"Y":250,"W":16,"H":120},"label":"Slider","role":10}]},"select-open":{"scene":"select-open","platform":"","width":420,"height":320,"dark":false,"texts":[{"value":"Shell","bounds":{"X":24,"Y":24,"W":372,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":31.96},{"value":"bash","bounds":{"X":35,"Y":57,"W":198,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":30.82},{"value":"zsh","bounds":{"X":36,"Y":97,"W":192,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"layer":11,"canvasWidth":22.47},{"value":"bash","bounds":{"X":36,"Y":129,"W":192,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"layer":11,"canvasWidth":30.82},{"value":"fish","bounds":{"X":36,"Y":161,"W":192,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"layer":11,"canvasWidth":23.28},{"value":"PowerShell","bounds":{"X":36,"Y":193,"W":192,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"layer":11,"canvasWidth":71.45},{"value":"cmd","bounds":{"X":36,"Y":225,"W":192,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"layer":11,"canvasWidth":27.68}],"rectangles":[{"bounds":{"X":24,"Y":57,"W":240,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":58,"W":238,"H":30},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":93,"W":240,"H":168},"radius":10,"color":[0.8980392,0.8980392,0.8980392,1],"layer":11},{"bounds":{"X":25,"Y":94,"W":238,"H":166},"radius":9,"color":[1,1,1,1],"layer":11}],"triangles":[{"points":[[242.47,71.53],[246.47,75.53],[243.53,70.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243.53,70.47],[246.47,75.53],[247.53,74.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[247.53,75.53],[251.53,71.53],[246.47,74.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[246.47,74.47],[251.53,71.53],[250.47,70.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[247,75],[246.47,75.53],[247,75.75]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[247,75],[247,75.75],[247.53,75.53]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243.75,71],[243.65,71.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243.65,71.38],[243.38,71.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243.38,71.65],[243,71.75]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243,71.75],[242.63,71.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[242.63,71.65],[242.35,71.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[242.35,71.38],[242.25,71]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[242.25,71],[242.35,70.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[242.35,70.63],[242.63,70.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[242.63,70.35],[243,70.25]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243,70.25],[243.38,70.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243.38,70.35],[243.65,70.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243.65,70.63],[243.75,71]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251.75,71],[251.65,71.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251.65,71.38],[251.38,71.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251.38,71.65],[251,71.75]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251,71.75],[250.63,71.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[250.63,71.65],[250.35,71.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[250.35,71.38],[250.25,71]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[250.25,71],[250.35,70.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[250.35,70.63],[250.63,70.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[250.63,70.35],[251,70.25]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251,70.25],[251.38,70.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251.38,70.35],[251.65,70.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251.65,70.63],[251.75,71]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[247.14,141.26],[240.72,147.68],[248.2,142.32]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[248.2,142.32],[240.72,147.68],[241.78,148.74]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[241.78,147.68],[238.86,144.76],[240.72,148.74]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[240.72,148.74],[238.86,144.76],[237.8,145.82]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[241.25,148.21],[241.78,148.74],[241.25,148.96]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[241.25,148.21],[241.25,148.96],[240.72,148.74]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[248.42,141.79],[248.32,142.17]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[248.32,142.17],[248.04,142.44]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[248.04,142.44],[247.67,142.54]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[247.67,142.54],[247.29,142.44]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[247.29,142.44],[247.02,142.17]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[247.02,142.17],[246.92,141.79]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[246.92,141.79],[247.02,141.42]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[247.02,141.42],[247.29,141.14]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[247.29,141.14],[247.67,141.04]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[247.67,141.04],[248.04,141.14]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[248.04,141.14],[248.32,141.42]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[248.32,141.42],[248.42,141.79]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[239.08,145.29],[238.98,145.67]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[238.98,145.67],[238.71,145.94]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[238.71,145.94],[238.33,146.04]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[238.33,146.04],[237.96,145.94]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[237.96,145.94],[237.68,145.67]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[237.68,145.67],[237.58,145.29]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[237.58,145.29],[237.68,144.92]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[237.68,144.92],[237.96,144.64]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[237.96,144.64],[238.33,144.54]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[238.33,144.54],[238.71,144.64]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[238.71,144.64],[238.98,144.92]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[238.98,144.92],[239.08,145.29]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11}],"shadows":[{"bounds":{"X":24,"Y":57,"W":240,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":24,"Y":93,"W":240,"H":168},"radius":10,"color":[0,0,0,0.1],"offsetY":4,"blur":6,"spread":-1,"layer":11},{"bounds":{"X":24,"Y":93,"W":240,"H":168},"radius":10,"color":[0,0,0,0.1],"offsetY":2,"blur":4,"spread":-2,"layer":11}],"hits":[{"id":"parity/#0/#167772160/#5","bounds":{"X":24,"Y":57,"W":240,"H":32},"label":"Shell","role":7},{"id":"parity/#0/#167772160/#6","bounds":{"X":0,"Y":0,"W":420,"H":320},"label":"Dismiss select","role":1,"layer":11},{"id":"none","bounds":{"X":24,"Y":93,"W":240,"H":168},"layer":11},{"id":"none","bounds":{"X":24,"Y":93,"W":240,"H":168},"label":"Shell","role":15,"layer":11},{"id":"parity/#0/#167772160/#0","bounds":{"X":28,"Y":97,"W":232,"H":32},"label":"zsh","role":16,"layer":11},{"id":"parity/#0/#167772160/#1","bounds":{"X":28,"Y":129,"W":232,"H":32},"label":"bash","role":16,"layer":11},{"id":"parity/#0/#167772160/#2","bounds":{"X":28,"Y":161,"W":232,"H":32},"label":"fish","role":16,"layer":11},{"id":"parity/#0/#167772160/#3","bounds":{"X":28,"Y":193,"W":232,"H":32},"label":"PowerShell","role":16,"layer":11},{"id":"parity/#0/#167772160/#4","bounds":{"X":28,"Y":225,"W":232,"H":32},"label":"cmd","role":16,"layer":11}]},"table":{"scene":"table","platform":"","width":560,"height":360,"dark":false,"texts":[{"value":"Servers","bounds":{"X":24,"Y":24,"W":512,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":86.71},{"value":"Name","bounds":{"X":32,"Y":67,"W":184,"H":40},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":67,"W":184,"H":40},"canvasWidth":37.63},{"value":"State","bounds":{"X":232,"Y":67,"W":104,"H":40},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":67,"W":104,"H":40},"canvasWidth":33.35},{"value":"Latency","bounds":{"X":476.72,"Y":67,"W":51.28,"H":40},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":67,"W":176,"H":40},"canvasWidth":51.28},{"value":"↑","bounds":{"X":273.59,"Y":67,"W":12,"H":40},"size":14,"weight":0.15,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":11.53},{"value":"web-01","bounds":{"X":32,"Y":107,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":107,"W":184,"H":36},"canvasWidth":47.19},{"value":"Running","bounds":{"X":232,"Y":107,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":107,"W":104,"H":36},"canvasWidth":51.93},{"value":"12 ms","bounds":{"X":491.69,"Y":107,"W":36.31,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":107,"W":176,"H":36},"canvasWidth":36.31},{"value":"web-02","bounds":{"X":32,"Y":143,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":143,"W":184,"H":36},"canvasWidth":49.92},{"value":"Running","bounds":{"X":232,"Y":143,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":143,"W":104,"H":36},"canvasWidth":51.93},{"value":"9 ms","bounds":{"X":497.02,"Y":143,"W":30.98,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":143,"W":176,"H":36},"canvasWidth":30.98},{"value":"db-primary","bounds":{"X":32,"Y":179,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":179,"W":184,"H":36},"canvasWidth":71.11},{"value":"Degraded","bounds":{"X":232,"Y":179,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":179,"W":104,"H":36},"canvasWidth":62.68},{"value":"48 ms","bounds":{"X":488.36,"Y":179,"W":39.64,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":179,"W":176,"H":36},"canvasWidth":39.64},{"value":"db-replica","bounds":{"X":32,"Y":215,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":215,"W":184,"H":36},"canvasWidth":65.5},{"value":"Running","bounds":{"X":232,"Y":215,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":215,"W":104,"H":36},"canvasWidth":51.93},{"value":"15 ms","bounds":{"X":491.71,"Y":215,"W":36.29,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":215,"W":176,"H":36},"canvasWidth":36.29},{"value":"cache","bounds":{"X":32,"Y":251,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":251,"W":184,"H":36},"canvasWidth":38.68},{"value":"Stopped","bounds":{"X":232,"Y":251,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":251,"W":104,"H":36},"canvasWidth":53.6},{"value":"-","bounds":{"X":521.82,"Y":251,"W":6.18,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":251,"W":176,"H":36},"canvasWidth":6.18},{"value":"build-agent-long-name","bounds":{"X":32,"Y":287,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":287,"W":184,"H":36},"canvasWidth":148.02},{"value":"Running","bounds":{"X":232,"Y":287,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":287,"W":104,"H":36},"canvasWidth":51.93},{"value":"103 ms","bounds":{"X":483.11,"Y":287,"W":44.89,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":287,"W":176,"H":36},"canvasWidth":44.89},{"value":"监控服务器","bounds":{"X":32,"Y":323,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":323,"W":184,"H":36},"canvasWidth":70},{"value":"运行中","bounds":{"X":232,"Y":323,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":323,"W":104,"H":36},"canvasWidth":42},{"value":"7 ms","bounds":{"X":497.74,"Y":323,"W":30.26,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":323,"W":176,"H":36},"canvasWidth":30.26}],"rectangles":[{"bounds":{"X":24,"Y":106,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":24,"Y":142,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":24,"Y":178,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":24,"Y":179,"W":512,"H":36},"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":214,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":24,"Y":250,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":24,"Y":286,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":24,"Y":322,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]}],"triangles":null,"hits":[{"id":"parity/heads/#0","bounds":{"X":24,"Y":67,"W":200,"H":40},"label":"Name","role":1},{"id":"parity/heads/#1","bounds":{"X":224,"Y":67,"W":120,"H":40},"label":"State","role":1},{"id":"parity/heads/#2","bounds":{"X":344,"Y":67,"W":192,"H":40},"label":"Latency","role":1},{"id":"parity/rows/#0","bounds":{"X":24,"Y":107,"W":512,"H":36},"label":"web-01","role":1},{"id":"parity/rows/#1","bounds":{"X":24,"Y":143,"W":512,"H":36},"label":"web-02","role":1},{"id":"parity/rows/#2","bounds":{"X":24,"Y":179,"W":512,"H":36},"label":"db-primary","role":1},{"id":"parity/rows/#3","bounds":{"X":24,"Y":215,"W":512,"H":36},"label":"db-replica","role":1},{"id":"parity/rows/#4","bounds":{"X":24,"Y":251,"W":512,"H":36},"label":"cache","role":1},{"id":"parity/rows/#5","bounds":{"X":24,"Y":287,"W":512,"H":36},"label":"build-agent-long-name","role":1},{"id":"parity/rows/#6","bounds":{"X":24,"Y":323,"W":512,"H":36},"label":"监控服务器","role":1}]},"tabs":{"scene":"tabs","platform":"","width":520,"height":300,"dark":false,"texts":[{"value":"General","bounds":{"X":79.6,"Y":27,"W":155.33,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,0.6],"clip":{"X":27,"Y":27,"W":155.33333,"H":30},"canvasWidth":50.13},{"value":"Keys","bounds":{"X":243.95,"Y":27,"W":155.33,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":182.33333,"Y":27,"W":155.33333,"H":30},"canvasWidth":32.11},{"value":"Advanced","bounds":{"X":382.72,"Y":27,"W":155.33,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,0.6],"clip":{"X":337.66666,"Y":27,"W":155.33333,"H":30},"canvasWidth":65.24},{"value":"Keys are read from ~/.ssh and the agent.","bounds":{"X":24,"Y":76,"W":472,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":260.43},{"value":"Overview","bounds":{"X":53.12,"Y":116,"W":113.5,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,0.6],"clip":{"X":27,"Y":116,"W":113.5,"H":30},"canvasWidth":61.26},{"value":"Files","bounds":{"X":186.34,"Y":116,"W":113.5,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,0.6],"clip":{"X":144.5,"Y":116,"W":113.5,"H":30},"canvasWidth":29.83},{"value":"Terminal","bounds":{"X":290.61,"Y":116,"W":113.5,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":262,"Y":116,"W":113.5,"H":30},"canvasWidth":56.29},{"value":"Monitor","bounds":{"X":411.38,"Y":116,"W":113.5,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,0.6],"clip":{"X":379.5,"Y":116,"W":113.5,"H":30},"canvasWidth":49.75},{"value":"A line variant with an underline.","bounds":{"X":24,"Y":170,"W":472,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":199.01}],"rectangles":[{"bounds":{"X":24,"Y":24,"W":472,"H":36},"radius":9.5,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":27,"Y":27,"W":155,"H":30},"radius":7.5,"color":[1,1,1,0]},{"bounds":{"X":27,"Y":60,"W":155,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,0]},{"bounds":{"X":182,"Y":27,"W":155,"H":30},"radius":7.5,"color":[1,1,1,1]},{"bounds":{"X":183,"Y":28,"W":153,"H":28},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":182,"Y":60,"W":155,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,0]},{"bounds":{"X":338,"Y":27,"W":155,"H":30},"radius":7.5,"color":[1,1,1,0]},{"bounds":{"X":338,"Y":60,"W":155,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,0]},{"bounds":{"X":24,"Y":113,"W":472,"H":36},"color":[1,1,1,0]},{"bounds":{"X":27,"Y":116,"W":114,"H":30},"radius":7.5,"color":[1,1,1,0]},{"bounds":{"X":27,"Y":149,"W":114,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,0]},{"bounds":{"X":145,"Y":116,"W":114,"H":30},"radius":7.5,"color":[1,1,1,0]},{"bounds":{"X":145,"Y":149,"W":114,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,0]},{"bounds":{"X":262,"Y":116,"W":114,"H":30},"radius":7.5,"color":[1,1,1,0]},{"bounds":{"X":262,"Y":149,"W":114,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,1]},{"bounds":{"X":380,"Y":116,"W":114,"H":30},"radius":7.5,"color":[1,1,1,0]},{"bounds":{"X":380,"Y":149,"W":114,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,0]}],"triangles":null,"shadows":[{"bounds":{"X":182,"Y":27,"W":155,"H":30},"radius":7.5,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":182,"Y":27,"W":155,"H":30},"radius":7.5,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1}],"hits":[{"id":"parity/#0/#150994944/#0","bounds":{"X":27,"Y":27,"W":155.33,"H":30},"label":"General","role":5},{"id":"parity/#0/#150994944/#1","bounds":{"X":182.33,"Y":27,"W":155.33,"H":30},"label":"Keys","role":5},{"id":"parity/#0/#150994944/#2","bounds":{"X":337.67,"Y":27,"W":155.33,"H":30},"label":"Advanced","role":5},{"id":"parity/#0/#150994945/#0","bounds":{"X":27,"Y":116,"W":113.5,"H":30},"label":"Overview","role":5},{"id":"parity/#0/#150994945/#1","bounds":{"X":144.5,"Y":116,"W":113.5,"H":30},"label":"Files","role":5},{"id":"parity/#0/#150994945/#2","bounds":{"X":262,"Y":116,"W":113.5,"H":30},"label":"Terminal","role":5},{"id":"parity/#0/#150994945/#3","bounds":{"X":379.5,"Y":116,"W":113.5,"H":30},"label":"Monitor","role":5}]},"text-bidi":{"scene":"text-bidi","platform":"","width":880,"height":640,"dark":false,"texts":[{"value":"The word שלום means peace in Hebrew.","bounds":{"X":16,"Y":16,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":238.76},{"value":"מחיר: 42.50 USD (כולל מע״מ) לכל יחידה","bounds":{"X":347.87,"Y":40,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":228.13},{"value":"اسم المستخدم: admin و كلمة المرور: 12345","bounds":{"X":341.02,"Y":64,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":234.98},{"value":"Connect to שרת-01 (192.168.1.1) failed: חיבור נכשל!","bounds":{"X":16,"Y":88,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":295.59},{"value":"(שלום) [עולם] {טוב} «abc» \u003cx\u003e","bounds":{"X":397.52,"Y":112,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":178.48},{"value":"בדיקה 123 של מספרים 4.5% ו-$7","bounds":{"X":386.67,"Y":136,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":189.33},{"value":"النسخة 2.0.1 من التطبيق متوفرة الآن","bounds":{"X":369.82,"Y":160,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":206.18},{"value":"‏hello world! (RLM first)","bounds":{"X":442.17,"Y":184,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":133.83},{"value":"The word שלום means peace in Hebrew.","bounds":{"X":16,"Y":208,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":293.86},{"value":"מחיר: 42.50 USD (כולל מע״מ) לכל יחידה","bounds":{"X":295.22,"Y":235,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":280.78},{"value":"اسم المستخدم: admin و كلمة المرور: 12345","bounds":{"X":286.79,"Y":262,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":289.21},{"value":"Connect to שרת-01 (192.168.1.1) failed: חיבור נכשל!","bounds":{"X":16,"Y":289,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":363.8},{"value":"(שלום) [עולם] {טוב} «abc» \u003cx\u003e","bounds":{"X":356.33,"Y":316,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":219.67},{"value":"בדיקה 123 של מספרים 4.5% ו-$7","bounds":{"X":342.98,"Y":343,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":233.02},{"value":"النسخة 2.0.1 من التطبيق متوفرة الآن","bounds":{"X":322.23,"Y":370,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":253.77},{"value":"‏hello world! (RLM first)","bounds":{"X":411.28,"Y":397,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":164.72},{"value":"end-aligned","bounds":{"X":16,"Y":424,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":60.1},{"value":"The word שלום means peace in Hebrew.","bounds":{"X":318.87,"Y":446,"W":560,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":257.13},{"value":"מחיר: 42.50 USD (כולל מע״מ) לכל יחידה","bounds":{"X":16,"Y":471,"W":560,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":245.68},{"value":"اسم المستخدم: admin و كلمة المرور: 12345","bounds":{"X":16,"Y":496,"W":560,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":253.06}],"rectangles":null,"triangles":null,"hits":null},"text-cjk":{"scene":"text-cjk","platform":"","width":880,"height":560,"dark":false,"texts":[{"value":"12 regular 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":16,"W":848,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":402.44},{"value":"12 medium 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":37,"W":848,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":407.41},{"value":"12 semibold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":58,"W":848,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":413.49},{"value":"12 bold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":79,"W":848,"H":19},"size":12,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":386.58},{"value":"14 regular 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":100,"W":848,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":470},{"value":"14 medium 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":123,"W":848,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":475.85},{"value":"14 semibold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":146,"W":848,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":482.98},{"value":"14 bold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":169,"W":848,"H":21},"size":14,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":451.64},{"value":"16 regular 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":192,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":536.74},{"value":"16 medium 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":217,"W":848,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":543.42},{"value":"16 semibold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":242,"W":848,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":551.58},{"value":"16 bold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":267,"W":848,"H":23},"size":16,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":515.75},{"value":"20 regular 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":292,"W":848,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":675.03},{"value":"20 medium 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":321,"W":848,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":683.45},{"value":"20 semibold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":350,"W":848,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":693.7},{"value":"20 bold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":379,"W":848,"H":27},"size":20,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":648.97},{"value":"24 regular 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":408,"W":848,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":810.39},{"value":"24 medium 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":441,"W":848,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":820.38},{"value":"24 semibold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":474,"W":848,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":832.58},{"value":"24 bold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":507,"W":848,"H":31},"size":24,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":778.82}],"rectangles":null,"triangles":null,"hits":null},"text-emoji":{"scene":"text-emoji","platform":"","width":880,"height":560,"dark":false,"texts":[{"value":"12 regular 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":16,"W":848,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":193.4},{"value":"12 medium 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":37,"W":848,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":197.7},{"value":"12 semibold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":58,"W":848,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":203.09},{"value":"12 bold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":79,"W":848,"H":19},"size":12,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":175.51},{"value":"14 regular 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":100,"W":848,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":226.12},{"value":"14 medium 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":123,"W":848,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":231.18},{"value":"14 semibold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":146,"W":848,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":237.51},{"value":"14 bold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":169,"W":848,"H":21},"size":14,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":205.39},{"value":"16 regular 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":192,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":258.02},{"value":"16 medium 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":217,"W":848,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":263.8},{"value":"16 semibold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":242,"W":848,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":271.05},{"value":"16 bold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":267,"W":848,"H":23},"size":16,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":234.31},{"value":"20 regular 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":292,"W":848,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":326.63},{"value":"20 medium 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":321,"W":848,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":333.92},{"value":"20 semibold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":350,"W":848,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":343.04},{"value":"20 bold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":379,"W":848,"H":27},"size":20,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":297.18},{"value":"24 regular 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":408,"W":848,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":392.31},{"value":"24 medium 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":441,"W":848,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":400.95},{"value":"24 semibold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":474,"W":848,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":411.79},{"value":"24 bold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":507,"W":848,"H":31},"size":24,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":356.66}],"rectangles":null,"triangles":null,"hits":null},"text-latin":{"scene":"text-latin","platform":"","width":880,"height":880,"dark":false,"texts":[{"value":"11 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":16,"W":848,"H":18},"size":11,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":436.53},{"value":"11 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":36,"W":848,"H":18},"size":11,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":445.44},{"value":"11 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":56,"W":848,"H":18},"size":11,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":455.37},{"value":"11 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":76,"W":848,"H":18},"size":11,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":435.07},{"value":"12 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":96,"W":848,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":478.55},{"value":"12 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":117,"W":848,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":488.25},{"value":"12 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":138,"W":848,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":499.07},{"value":"12 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":159,"W":848,"H":19},"size":12,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":476.91},{"value":"13 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":180,"W":848,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":518.53},{"value":"13 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":202,"W":848,"H":20},"size":13,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":529.07},{"value":"13 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":224,"W":848,"H":20},"size":13,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":540.83},{"value":"13 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":246,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":516.85},{"value":"14 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":268,"W":848,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":558.8},{"value":"14 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":291,"W":848,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":570.16},{"value":"14 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":314,"W":848,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":582.83},{"value":"14 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":337,"W":848,"H":21},"size":14,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":557.02},{"value":"16 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":360,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":638.23},{"value":"16 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":385,"W":848,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":651.2},{"value":"16 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":410,"W":848,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":665.69},{"value":"16 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":435,"W":848,"H":23},"size":16,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":636.18},{"value":"18 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":460,"W":848,"H":25},"size":18,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":717.98},{"value":"18 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":487,"W":848,"H":25},"size":18,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":732.59},{"value":"18 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":514,"W":848,"H":25},"size":18,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":748.91},{"value":"18 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":541,"W":848,"H":25},"size":18,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":715.73},{"value":"20 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":568,"W":848,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":801.88},{"value":"20 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":597,"W":848,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":818.17},{"value":"20 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":626,"W":848,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":836.34},{"value":"20 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":655,"W":848,"H":27},"size":20,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":799.51},{"value":"24 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":684,"W":848,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":16,"Y":684,"W":848,"H":31},"canvasWidth":962.61},{"value":"24 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":717,"W":848,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":16,"Y":717,"W":848,"H":31},"canvasWidth":982.05},{"value":"24 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":750,"W":848,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":16,"Y":750,"W":848,"H":31},"canvasWidth":1003.75},{"value":"24 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":783,"W":848,"H":31},"size":24,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":16,"Y":783,"W":848,"H":31},"canvasWidth":959.46}],"rectangles":null,"triangles":null,"hits":null},"text-mixed":{"scene":"text-mixed","platform":"","width":880,"height":560,"dark":false,"texts":[{"value":"12 regular Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":16,"W":848,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":354.32},{"value":"12 medium Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":37,"W":848,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":360.69},{"value":"12 semibold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":58,"W":848,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":368.14},{"value":"12 bold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":79,"W":848,"H":19},"size":12,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":342.64},{"value":"14 regular Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":100,"W":848,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":413.85},{"value":"14 medium Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":123,"W":848,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":421.34},{"value":"14 semibold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":146,"W":848,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":430.08},{"value":"14 bold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":169,"W":848,"H":21},"size":14,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":400.37},{"value":"16 regular Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":192,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":472.58},{"value":"16 medium Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":217,"W":848,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":481.13},{"value":"16 semibold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":242,"W":848,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":491.12},{"value":"16 bold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":267,"W":848,"H":23},"size":16,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":457.16},{"value":"20 regular Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":292,"W":848,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":594.82},{"value":"20 medium Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":321,"W":848,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":605.58},{"value":"20 semibold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":350,"W":848,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":618.13},{"value":"20 bold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":379,"W":848,"H":27},"size":20,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":575.73},{"value":"24 regular Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":408,"W":848,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":714.14},{"value":"24 medium Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":441,"W":848,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":726.94},{"value":"24 semibold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":474,"W":848,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":741.89},{"value":"24 bold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":507,"W":848,"H":31},"size":24,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":690.93}],"rectangles":null,"triangles":null,"hits":null},"text-mono":{"scene":"text-mono","platform":"","width":640,"height":360,"dark":false,"texts":[{"value":"mono system","bounds":{"X":16,"Y":16,"W":608,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":87.54},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":41,"W":608,"H":13},"size":11,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":58,"W":608,"H":15},"size":12,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":77,"W":608,"H":16},"size":13,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":97,"W":608,"H":17},"size":14,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":118,"W":608,"H":19},"size":16,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"mono classic","bounds":{"X":16,"Y":141,"W":608,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":85.25},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":166,"W":608,"H":13},"size":11,"weight":0,"mono":true,"monoFace":1,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":183,"W":608,"H":15},"size":12,"weight":0,"mono":true,"monoFace":1,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":202,"W":608,"H":16},"size":13,"weight":0,"mono":true,"monoFace":1,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":222,"W":608,"H":17},"size":14,"weight":0,"mono":true,"monoFace":1,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":243,"W":608,"H":19},"size":16,"weight":0,"mono":true,"monoFace":1,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0}],"rectangles":null,"triangles":null,"hits":null},"text-scripts":{"scene":"text-scripts","platform":"","width":880,"height":900,"dark":false,"texts":[{"value":"Arabic","bounds":{"X":16,"Y":16,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":32.24},{"value":"السلام عليكم ورحمة الله وبركاته. هذه تجربة لعرض النص العربي","bounds":{"X":444.94,"Y":37,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":419.06},{"value":"السلام عليكم ورحمة الله وبركاته. هذه تجربة لعرض النص العربي","bounds":{"X":516.31,"Y":63,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":347.69},{"value":"Persian","bounds":{"X":16,"Y":86,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":37.18},{"value":"سلام دنیا! این یک متن آزمایشی فارسی است","bounds":{"X":566.16,"Y":107,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":297.84},{"value":"سلام دنیا! این یک متن آزمایشی فارسی است","bounds":{"X":617.13,"Y":133,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":246.87},{"value":"Hebrew","bounds":{"X":16,"Y":156,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":39.24},{"value":"שלום עולם! זוהי דוגמה להצגת טקסט בעברית בממשק המשתמש","bounds":{"X":436.62,"Y":177,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":427.38},{"value":"שלום עולם! זוהי דוגמה להצגת טקסט בעברית בממשק המשתמש","bounds":{"X":508.55,"Y":203,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":355.45},{"value":"Thai","bounds":{"X":16,"Y":226,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":21.55},{"value":"สวัสดีครับ นี่คือตัวอย่างข้อความภาษาไทยในอินเทอร์เฟซผู้ใช้","bounds":{"X":16,"Y":247,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":366.8},{"value":"สวัสดีครับ นี่คือตัวอย่างข้อความภาษาไทยในอินเทอร์เฟซผู้ใช้","bounds":{"X":16,"Y":273,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":308.68},{"value":"Hindi","bounds":{"X":16,"Y":296,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":25.67},{"value":"नमस्ते दुनिया! यह यूज़र इंटरफ़ेस में हिन्दी पाठ दिखाने का उदाहरण है","bounds":{"X":16,"Y":317,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":422.54},{"value":"नमस्ते दुनिया! यह यूज़र इंटरफ़ेस में हिन्दी पाठ दिखाने का उदाहरण है","bounds":{"X":16,"Y":343,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":349.28},{"value":"Bengali","bounds":{"X":16,"Y":366,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":36.82},{"value":"ওহে বিশ্ব! এটি ব্যবহারকারী ইন্টারফেসে বাংলা লেখা দেখানোর একটি উদাহরণ","bounds":{"X":16,"Y":387,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":545.52},{"value":"ওহে বিশ্ব! এটি ব্যবহারকারী ইন্টারফেসে বাংলা লেখা দেখানোর একটি উদাহরণ","bounds":{"X":16,"Y":413,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":454.4},{"value":"Tamil","bounds":{"X":16,"Y":436,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":27.11},{"value":"வணக்கம் உலகம்! இது பயனர் இடைமுகத்தில் தமிழ் உரையைக் காட்டும் எடுத்துக்காட்டு","bounds":{"X":16,"Y":457,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":783.44},{"value":"வணக்கம் உலகம்! இது பயனர் இடைமுகத்தில் தமிழ் உரையைக் காட்டும் எடுத்துக்காட்டு","bounds":{"X":16,"Y":483,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":655.77},{"value":"Telugu","bounds":{"X":16,"Y":506,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":34.5},{"value":"నమస్కారం ప్రపంచం! ఇది తెలుగు పాఠ్యానికి ఒక ఉదాహరణ","bounds":{"X":16,"Y":527,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":446.02},{"value":"నమస్కారం ప్రపంచం! ఇది తెలుగు పాఠ్యానికి ఒక ఉదాహరణ","bounds":{"X":16,"Y":553,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":372.55},{"value":"Korean","bounds":{"X":16,"Y":576,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":35.73},{"value":"안녕하세요 세계! 사용자 인터페이스에서 한국어 텍스트를 표시하는 예제입니다","bounds":{"X":16,"Y":597,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":562.66},{"value":"안녕하세요 세계! 사용자 인터페이스에서 한국어 텍스트를 표시하는 예제입니다","bounds":{"X":16,"Y":623,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":453.92},{"value":"Khmer","bounds":{"X":16,"Y":646,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":32.72},{"value":"សួស្តី​ពិភពលោក ភាសាខ្មែរ ជាឧទាហរណ៍","bounds":{"X":16,"Y":667,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":273.59},{"value":"សួស្តី​ពិភពលោក ភាសាខ្មែរ ជាឧទាហរណ៍","bounds":{"X":16,"Y":693,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":229.38},{"value":"Myanmar","bounds":{"X":16,"Y":716,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":46.8},{"value":"မင်္ဂလာပါ ကမ္ဘာ မြန်မာဘာသာ စာသား နမူနာ","bounds":{"X":16,"Y":737,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":284.23},{"value":"မင်္ဂလာပါ ကမ္ဘာ မြန်မာဘာသာ စာသား နမူနာ","bounds":{"X":16,"Y":763,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":236.97}],"rectangles":null,"triangles":null,"hits":null},"text-wrap":{"scene":"text-wrap","platform":"","width":960,"height":560,"dark":false,"texts":[{"value":"Viva lays text out in","bounds":{"X":25,"Y":25,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":114.92},{"value":"lines: a paragraph","bounds":{"X":25,"Y":45,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":105.64},{"value":"breaks at spaces,","bounds":{"X":25,"Y":65,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":103.99},{"value":"between East Asian","bounds":{"X":25,"Y":85,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":115.94},{"value":"characters, after the","bounds":{"X":25,"Y":105,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":120.03},{"value":"separators of a long","bounds":{"X":25,"Y":125,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":118.25},{"value":"path such as /usr/local/","bounds":{"X":25,"Y":145,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":138.54},{"value":"share/applications/","bounds":{"X":25,"Y":165,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":112.96},{"value":"example.desktop, and","bounds":{"X":25,"Y":185,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130.25},{"value":"as a last resort inside a","bounds":{"X":25,"Y":205,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":135.61},{"value":"word like","bounds":{"X":25,"Y":225,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":53.71},{"value":"pneumonoultramicros…","bounds":{"X":25,"Y":245,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":139.78},{"value":"文本按宽度折行:东亚","bounds":{"X":25,"Y":277,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130},{"value":"文字可以在任意两个字","bounds":{"X":25,"Y":297,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130},{"value":"符之间断开,但是句","bounds":{"X":25,"Y":317,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":117},{"value":"号、逗号等标点不会出","bounds":{"X":25,"Y":337,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130},{"value":"现在行首。日本語の文","bounds":{"X":25,"Y":357,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130},{"value":"章も同じように折り返","bounds":{"X":25,"Y":377,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130},{"value":"されます。","bounds":{"X":25,"Y":397,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":65},{"value":"Viva lays text out","bounds":{"X":25,"Y":429,"W":142,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":127.8},{"value":"in lines: a","bounds":{"X":25,"Y":452,"W":142,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":69.84},{"value":"paragraph break…","bounds":{"X":25,"Y":475,"W":142,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":137.72},{"value":"Viva lays text out in lines: a","bounds":{"X":201,"Y":25,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":159.82},{"value":"paragraph breaks at spaces,","bounds":{"X":201,"Y":45,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":168.24},{"value":"between East Asian characters, after","bounds":{"X":201,"Y":65,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":217.23},{"value":"the separators of a long path such","bounds":{"X":201,"Y":85,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":202.12},{"value":"as /usr/local/share/applications/","bounds":{"X":201,"Y":105,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":189.88},{"value":"example.desktop, and as a last resort","bounds":{"X":201,"Y":125,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":220.42},{"value":"inside a word like","bounds":{"X":201,"Y":145,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":102.67},{"value":"pneumonoultramicroscopicsilicovolc","bounds":{"X":201,"Y":165,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":216.31},{"value":"anoconiosis.","bounds":{"X":201,"Y":185,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":74.15},{"value":"文本按宽度折行:东亚文字可以在任意","bounds":{"X":201,"Y":217,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":221},{"value":"两个字符之间断开,但是句号、逗号等","bounds":{"X":201,"Y":237,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":221},{"value":"标点不会出现在行首。日本語の文章も","bounds":{"X":201,"Y":257,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":221},{"value":"同じように折り返されます。","bounds":{"X":201,"Y":277,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":169},{"value":"Viva lays text out in lines: a","bounds":{"X":201,"Y":309,"W":222,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":201.51},{"value":"paragraph breaks at spaces,","bounds":{"X":201,"Y":332,"W":222,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":211.66},{"value":"between East Asian charact…","bounds":{"X":201,"Y":355,"W":222,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":221.13},{"value":"Viva lays text out in lines: a paragraph breaks at spaces,","bounds":{"X":457,"Y":25,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":331.58},{"value":"between East Asian characters, after the separators of a","bounds":{"X":457,"Y":45,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":332.19},{"value":"long path such as /usr/local/share/applications/","bounds":{"X":457,"Y":65,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":280.55},{"value":"example.desktop, and as a last resort inside a word like","bounds":{"X":457,"Y":85,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":326.59},{"value":"pneumonoultramicroscopicsilicovolcanoconiosis.","bounds":{"X":457,"Y":105,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":290.46},{"value":"文本按宽度折行:东亚文字可以在任意两个字符之间断开,","bounds":{"X":457,"Y":137,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":338},{"value":"但是句号、逗号等标点不会出现在行首。日本語の文章も同","bounds":{"X":457,"Y":157,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":338},{"value":"じように折り返されます。","bounds":{"X":457,"Y":177,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":156},{"value":"Viva lays text out in lines: a paragraph breaks","bounds":{"X":457,"Y":209,"W":342,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":336.84},{"value":"at spaces, between East Asian characters,","bounds":{"X":457,"Y":232,"W":342,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":315.14},{"value":"after the separators of a long path such as /…","bounds":{"X":457,"Y":255,"W":342,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":337.98}],"rectangles":null,"triangles":[{"points":[[16,16],[176,16],[175,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[16,16],[175,17],[17,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,16],[176,507],[175,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,16],[175,506],[175,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,507],[16,507],[17,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,507],[17,506],[175,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[16,507],[16,16],[17,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[16,507],[17,17],[17,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,16],[432,16],[431,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,16],[431,17],[193,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,16],[432,507],[431,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,16],[431,506],[431,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,507],[192,507],[193,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,507],[193,506],[431,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,507],[192,16],[193,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,507],[193,17],[193,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,16],[808,16],[807,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,16],[807,17],[449,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,16],[808,507],[807,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,16],[807,506],[807,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,507],[448,507],[449,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,507],[449,506],[807,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,507],[448,16],[449,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,507],[449,17],[449,506]],"color":[0.8980392,0.8980392,0.8980392,1]}],"hits":null},"text-wrap-scripts":{"scene":"text-wrap-scripts","platform":"","width":960,"height":720,"dark":false,"texts":[{"value":"هذه فقرة طويلة من","bounds":{"X":57.17,"Y":25,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":109.83},{"value":"النص العربي تُعرض في","bounds":{"X":38.73,"Y":45,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":128.27},{"value":"عمود ضيق لاختبار","bounds":{"X":64.71,"Y":65,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":102.29},{"value":"الالتفاف الأسطري واتجاه","bounds":{"X":34.56,"Y":85,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":132.44},{"value":"الكتابة من اليمين إلى","bounds":{"X":47.37,"Y":105,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":119.63},{"value":"اليسار في واجهة","bounds":{"X":76.7,"Y":125,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":90.3},{"value":"المستخدم.","bounds":{"X":109.98,"Y":145,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":57.02},{"value":"זוהי פסקה ארוכה של","bounds":{"X":53.76,"Y":175,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":113.24},{"value":"טקסט בעברית המוצגת","bounds":{"X":43.24,"Y":195,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":123.76},{"value":"בעמודה צרה כדי לבדוק","bounds":{"X":40.56,"Y":215,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":126.44},{"value":"את שבירת השורות ואת","bounds":{"X":40.69,"Y":235,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":126.31},{"value":"כיוון הכתיבה מימין","bounds":{"X":65.07,"Y":255,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":101.93},{"value":"לשמאל בממשק","bounds":{"X":81.4,"Y":275,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":85.6},{"value":"המשתמש.","bounds":{"X":110.21,"Y":295,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":56.79},{"value":"ประเทศไทยมีภาษาไทย","bounds":{"X":25,"Y":325,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":111.27},{"value":"เป็นภาษาราชการ ข้อความนี้","bounds":{"X":25,"Y":345,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":136.93},{"value":"ไม่มีช่องว่างระหว่างคำจึงต้","bounds":{"X":25,"Y":365,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":131.29},{"value":"องตัดบรรทัดตามพยางค์เพื่","bounds":{"X":25,"Y":385,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":137.2},{"value":"อให้พอดีกับความกว้า","bounds":{"X":25,"Y":405,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":105.07},{"value":"งของคอลัมน์","bounds":{"X":25,"Y":425,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":66.69},{"value":"यह हिन्दी भाषा में एक लंबा","bounds":{"X":25,"Y":455,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":136.25},{"value":"अनुच्छेद है जो संकरे स्तंभ में","bounds":{"X":25,"Y":475,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":141.54},{"value":"पंक्ति विभाजन और","bounds":{"X":25,"Y":495,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":100.36},{"value":"संयुक्ताक्षरों की जाँच के","bounds":{"X":25,"Y":515,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":118.28},{"value":"लिए दिखाया गया है।","bounds":{"X":25,"Y":535,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":104.46},{"value":"한국어 문단은 단어","bounds":{"X":25,"Y":565,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":111.02},{"value":"사이의 공백에서","bounds":{"X":25,"Y":585,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":94.51},{"value":"줄바꿈이 됩니다. 아주","bounds":{"X":25,"Y":605,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":127.61},{"value":"긴 단어는 폭에 맞지","bounds":{"X":25,"Y":625,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":114.53},{"value":"않으면 음절 사이에서","bounds":{"X":25,"Y":645,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":124.02},{"value":"나뉩니다","bounds":{"X":25,"Y":665,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":52},{"value":"대한민국만세대한민국","bounds":{"X":25,"Y":685,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130},{"value":"만세.","bounds":{"X":25,"Y":705,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.59},{"value":"هذه فقرة طويلة من النص العربي تُعرض","bounds":{"X":201.21,"Y":25,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":221.79},{"value":"في عمود ضيق لاختبار الالتفاف الأسطري","bounds":{"X":203.38,"Y":45,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":219.62},{"value":"واتجاه الكتابة من اليمين إلى اليسار في","bounds":{"X":204.18,"Y":65,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":218.82},{"value":"واجهة المستخدم.","bounds":{"X":332.91,"Y":85,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":90.09},{"value":"זוהי פסקה ארוכה של טקסט בעברית","bounds":{"X":227.64,"Y":115,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":195.36},{"value":"המוצגת בעמודה צרה כדי לבדוק את","bounds":{"X":230.78,"Y":135,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":192.22},{"value":"שבירת השורות ואת כיוון הכתיבה מימין","bounds":{"X":211.88,"Y":155,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":211.12},{"value":"לשמאל בממשק המשתמש.","bounds":{"X":277.09,"Y":175,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":145.91},{"value":"ประเทศไทยมีภาษาไทยเป็นภาษาราชการ ข้","bounds":{"X":201,"Y":205,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":205.55},{"value":"อความนี้ไม่มีช่องว่างระหว่างคำจึงต้","bounds":{"X":201,"Y":225,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":173.94},{"value":"องตัดบรรทัดตามพยางค์เพื่อให้พอดีกับควา","bounds":{"X":201,"Y":245,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":215.08},{"value":"มกว้างของคอลัมน์","bounds":{"X":201,"Y":265,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":93.88},{"value":"यह हिन्दी भाषा में एक लंबा अनुच्छेद है जो","bounds":{"X":201,"Y":295,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":211.42},{"value":"संकरे स्तंभ में पंक्ति विभाजन और","bounds":{"X":201,"Y":315,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":170.24},{"value":"संयुक्ताक्षरों की जाँच के लिए दिखाया गया","bounds":{"X":201,"Y":335,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":209.61},{"value":"है।","bounds":{"X":201,"Y":355,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":13.13},{"value":"한국어 문단은 단어 사이의 공백에서","bounds":{"X":201,"Y":385,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":209.04},{"value":"줄바꿈이 됩니다. 아주 긴 단어는 폭에","bounds":{"X":201,"Y":405,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":216.14},{"value":"맞지 않으면 음절 사이에서 나뉩니다","bounds":{"X":201,"Y":425,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":209.04},{"value":"대한민국만세대한민국만세.","bounds":{"X":201,"Y":445,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":159.59},{"value":"هذه فقرة طويلة من النص العربي تُعرض في عمود ضيق","bounds":{"X":489.51,"Y":25,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":309.49},{"value":"لاختبار الالتفاف الأسطري واتجاه الكتابة من اليمين إلى اليسار","bounds":{"X":464.58,"Y":45,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":334.42},{"value":"في واجهة المستخدم.","bounds":{"X":689.08,"Y":65,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":109.92},{"value":"זוהי פסקה ארוכה של טקסט בעברית המוצגת בעמודה צרה כדי","bounds":{"X":465.38,"Y":95,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":333.62},{"value":"לבדוק את שבירת השורות ואת כיוון הכתיבה מימין לשמאל","bounds":{"X":487.05,"Y":115,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":311.95},{"value":"בממשק המשתמש.","bounds":{"X":696.46,"Y":135,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":102.54},{"value":"ประเทศไทยมีภาษาไทยเป็นภาษาราชการ ข้อความนี้ไม่มีช่องว่างระหว่า","bounds":{"X":457,"Y":165,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":337.5},{"value":"งคำจึงต้องตัดบรรทัดตามพยางค์เพื่อให้พอดีกับความกว้า","bounds":{"X":457,"Y":185,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":284.26},{"value":"งของคอลัมน์","bounds":{"X":457,"Y":205,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":66.69},{"value":"यह हिन्दी भाषा में एक लंबा अनुच्छेद है जो संकरे स्तंभ में पंक्ति","bounds":{"X":457,"Y":235,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":313.12},{"value":"विभाजन और संयुक्ताक्षरों की जाँच के लिए दिखाया गया है।","bounds":{"X":457,"Y":255,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":298.3},{"value":"한국어 문단은 단어 사이의 공백에서 줄바꿈이 됩니다. 아주","bounds":{"X":457,"Y":285,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":340.16},{"value":"긴 단어는 폭에 맞지 않으면 음절 사이에서 나뉩니다","bounds":{"X":457,"Y":305,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":297.57},{"value":"대한민국만세대한민국만세.","bounds":{"X":457,"Y":325,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":159.59}],"rectangles":null,"triangles":[{"points":[[16,16],[176,16],[175,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[16,16],[175,17],[17,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,16],[176,734],[175,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,16],[175,733],[175,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,734],[16,734],[17,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,734],[17,733],[175,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[16,734],[16,16],[17,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[16,734],[17,17],[17,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,16],[432,16],[431,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,16],[431,17],[193,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,16],[432,734],[431,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,16],[431,733],[431,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,734],[192,734],[193,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,734],[193,733],[431,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,734],[192,16],[193,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,734],[193,17],[193,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,16],[808,16],[807,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,16],[807,17],[449,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,16],[808,734],[807,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,16],[807,733],[807,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,734],[448,734],[449,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,734],[449,733],[807,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,734],[448,16],[449,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,734],[449,17],[449,733]],"color":[0.8980392,0.8980392,0.8980392,1]}],"hits":null}} \ No newline at end of file +{"baseline":{"scene":"baseline","platform":"","width":760,"height":700,"dark":false,"texts":[{"value":"HHHH","bounds":{"X":12,"Y":12,"W":110,"H":18},"size":11,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":31.39},{"value":"xxxx","bounds":{"X":130,"Y":12,"W":110,"H":18},"size":11,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":23.05},{"value":"Hpgy","bounds":{"X":248,"Y":12,"W":110,"H":18},"size":11,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":26.73},{"value":"HHHH","bounds":{"X":366,"Y":14.5,"W":110,"H":13},"size":11,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":34,"W":110,"H":18},"size":11,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":31.45},{"value":"xxxx","bounds":{"X":130,"Y":34,"W":110,"H":18},"size":11,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":23.53},{"value":"Hpgy","bounds":{"X":248,"Y":34,"W":110,"H":18},"size":11,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":27.01},{"value":"HHHH","bounds":{"X":366,"Y":36.5,"W":110,"H":13},"size":11,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":56,"W":110,"H":18},"size":11,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":31.5},{"value":"xxxx","bounds":{"X":130,"Y":56,"W":110,"H":18},"size":11,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":24.02},{"value":"Hpgy","bounds":{"X":248,"Y":56,"W":110,"H":18},"size":11,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":27.29},{"value":"HHHH","bounds":{"X":366,"Y":58.5,"W":110,"H":13},"size":11,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":78,"W":110,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.24},{"value":"xxxx","bounds":{"X":130,"Y":78,"W":110,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":25.15},{"value":"Hpgy","bounds":{"X":248,"Y":78,"W":110,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.16},{"value":"HHHH","bounds":{"X":366,"Y":80,"W":110,"H":15},"size":12,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":101,"W":110,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.31},{"value":"xxxx","bounds":{"X":130,"Y":101,"W":110,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":25.66},{"value":"Hpgy","bounds":{"X":248,"Y":101,"W":110,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.46},{"value":"HHHH","bounds":{"X":366,"Y":103,"W":110,"H":15},"size":12,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":124,"W":110,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.36},{"value":"xxxx","bounds":{"X":130,"Y":124,"W":110,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":26.2},{"value":"Hpgy","bounds":{"X":248,"Y":124,"W":110,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.77},{"value":"HHHH","bounds":{"X":366,"Y":126,"W":110,"H":15},"size":12,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":147,"W":110,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":37.1},{"value":"xxxx","bounds":{"X":130,"Y":147,"W":110,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":27.24},{"value":"Hpgy","bounds":{"X":248,"Y":147,"W":110,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":31.59},{"value":"HHHH","bounds":{"X":366,"Y":149,"W":110,"H":16},"size":13,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":171,"W":110,"H":20},"size":13,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":37.17},{"value":"xxxx","bounds":{"X":130,"Y":171,"W":110,"H":20},"size":13,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":27.8},{"value":"Hpgy","bounds":{"X":248,"Y":171,"W":110,"H":20},"size":13,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":31.92},{"value":"HHHH","bounds":{"X":366,"Y":173,"W":110,"H":16},"size":13,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":195,"W":110,"H":20},"size":13,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":37.22},{"value":"xxxx","bounds":{"X":130,"Y":195,"W":110,"H":20},"size":13,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":28.39},{"value":"Hpgy","bounds":{"X":248,"Y":195,"W":110,"H":20},"size":13,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":32.25},{"value":"HHHH","bounds":{"X":366,"Y":197,"W":110,"H":16},"size":13,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":219,"W":110,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":39.95},{"value":"xxxx","bounds":{"X":130,"Y":219,"W":110,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.34},{"value":"Hpgy","bounds":{"X":248,"Y":219,"W":110,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.02},{"value":"HHHH","bounds":{"X":366,"Y":221,"W":110,"H":17},"size":14,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":244,"W":110,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":40.03},{"value":"xxxx","bounds":{"X":130,"Y":244,"W":110,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.94},{"value":"Hpgy","bounds":{"X":248,"Y":244,"W":110,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.37},{"value":"HHHH","bounds":{"X":366,"Y":246,"W":110,"H":17},"size":14,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":269,"W":110,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":40.09},{"value":"xxxx","bounds":{"X":130,"Y":269,"W":110,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":30.57},{"value":"Hpgy","bounds":{"X":248,"Y":269,"W":110,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.73},{"value":"HHHH","bounds":{"X":366,"Y":271,"W":110,"H":17},"size":14,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":294,"W":110,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":45.66},{"value":"xxxx","bounds":{"X":130,"Y":294,"W":110,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":33.53},{"value":"Hpgy","bounds":{"X":248,"Y":294,"W":110,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":38.88},{"value":"HHHH","bounds":{"X":366,"Y":296,"W":110,"H":19},"size":16,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":321,"W":110,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":45.75},{"value":"xxxx","bounds":{"X":130,"Y":321,"W":110,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.22},{"value":"Hpgy","bounds":{"X":248,"Y":321,"W":110,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":39.28},{"value":"HHHH","bounds":{"X":366,"Y":323,"W":110,"H":19},"size":16,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":348,"W":110,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":45.81},{"value":"xxxx","bounds":{"X":130,"Y":348,"W":110,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":34.94},{"value":"Hpgy","bounds":{"X":248,"Y":348,"W":110,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":39.69},{"value":"HHHH","bounds":{"X":366,"Y":350,"W":110,"H":19},"size":16,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":375,"W":110,"H":25},"size":18,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":51.36},{"value":"xxxx","bounds":{"X":130,"Y":375,"W":110,"H":25},"size":18,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":37.72},{"value":"Hpgy","bounds":{"X":248,"Y":375,"W":110,"H":25},"size":18,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":43.73},{"value":"HHHH","bounds":{"X":366,"Y":376.5,"W":110,"H":22},"size":18,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":404,"W":110,"H":25},"size":18,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":51.47},{"value":"xxxx","bounds":{"X":130,"Y":404,"W":110,"H":25},"size":18,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":38.5},{"value":"Hpgy","bounds":{"X":248,"Y":404,"W":110,"H":25},"size":18,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":44.19},{"value":"HHHH","bounds":{"X":366,"Y":405.5,"W":110,"H":22},"size":18,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":433,"W":110,"H":25},"size":18,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":51.54},{"value":"xxxx","bounds":{"X":130,"Y":433,"W":110,"H":25},"size":18,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":39.3},{"value":"Hpgy","bounds":{"X":248,"Y":433,"W":110,"H":25},"size":18,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":44.65},{"value":"HHHH","bounds":{"X":366,"Y":434.5,"W":110,"H":22},"size":18,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":462,"W":110,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":57.07},{"value":"xxxx","bounds":{"X":130,"Y":462,"W":110,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":41.91},{"value":"Hpgy","bounds":{"X":248,"Y":462,"W":110,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":48.59},{"value":"HHHH","bounds":{"X":366,"Y":463.5,"W":110,"H":24},"size":20,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":493,"W":110,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":57.19},{"value":"xxxx","bounds":{"X":130,"Y":493,"W":110,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":42.77},{"value":"Hpgy","bounds":{"X":248,"Y":493,"W":110,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":49.1},{"value":"HHHH","bounds":{"X":366,"Y":494.5,"W":110,"H":24},"size":20,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":524,"W":110,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":57.27},{"value":"xxxx","bounds":{"X":130,"Y":524,"W":110,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":43.67},{"value":"Hpgy","bounds":{"X":248,"Y":524,"W":110,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":49.61},{"value":"HHHH","bounds":{"X":366,"Y":525.5,"W":110,"H":24},"size":20,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":555,"W":110,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":68.48},{"value":"xxxx","bounds":{"X":130,"Y":555,"W":110,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":50.3},{"value":"Hpgy","bounds":{"X":248,"Y":555,"W":110,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":58.31},{"value":"HHHH","bounds":{"X":366,"Y":556,"W":110,"H":29},"size":24,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":590,"W":110,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":68.63},{"value":"xxxx","bounds":{"X":130,"Y":590,"W":110,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":51.33},{"value":"Hpgy","bounds":{"X":248,"Y":590,"W":110,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":58.92},{"value":"HHHH","bounds":{"X":366,"Y":591,"W":110,"H":29},"size":24,"weight":0.15,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"HHHH","bounds":{"X":12,"Y":625,"W":110,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":68.72},{"value":"xxxx","bounds":{"X":130,"Y":625,"W":110,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":52.41},{"value":"Hpgy","bounds":{"X":248,"Y":625,"W":110,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":59.53},{"value":"HHHH","bounds":{"X":366,"Y":626,"W":110,"H":29},"size":24,"weight":0.23,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0}],"rectangles":null,"triangles":null,"hits":null},"cards":{"scene":"cards","platform":"","width":560,"height":460,"dark":false,"texts":[{"value":"Card title","bounds":{"X":41,"Y":41,"W":478,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":59.21},{"value":"Card body in muted text.","bounds":{"X":41,"Y":70,"W":478,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":157.06}],"rectangles":[{"bounds":{"X":24,"Y":24,"W":512,"H":84},"radius":11,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":25,"W":510,"H":82},"radius":10,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":124,"W":64,"H":64},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":125,"W":62,"H":62},"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":100,"Y":124,"W":64,"H":64},"radius":2,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":101,"Y":125,"W":62,"H":62},"radius":1,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":176,"Y":124,"W":64,"H":64},"radius":4,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":177,"Y":125,"W":62,"H":62},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":252,"Y":124,"W":64,"H":64},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":253,"Y":125,"W":62,"H":62},"radius":6.5,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":328,"Y":124,"W":64,"H":64},"radius":11,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":329,"Y":125,"W":62,"H":62},"radius":10,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":404,"Y":124,"W":64,"H":64},"radius":16,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":405,"Y":125,"W":62,"H":62},"radius":15,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":204,"W":64,"H":48},"radius":10,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":25,"Y":205,"W":62,"H":46},"radius":9,"color":[1,1,1,1]},{"bounds":{"X":100,"Y":204,"W":64,"H":48},"radius":10,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":101,"Y":205,"W":62,"H":46},"radius":9,"color":[1,1,1,1]},{"bounds":{"X":176,"Y":204,"W":64,"H":48},"radius":10,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":177,"Y":205,"W":62,"H":46},"radius":9,"color":[1,1,1,1]},{"bounds":{"X":252,"Y":204,"W":64,"H":48},"radius":10,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":254,"Y":206,"W":60,"H":44},"radius":8,"color":[1,1,1,1]},{"bounds":{"X":328,"Y":204,"W":64,"H":48},"radius":10,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":331,"Y":207,"W":58,"H":42},"radius":7,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":268,"W":17,"H":17},"radius":8.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":53,"Y":268,"W":33,"H":33},"radius":16.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":98,"Y":268,"W":41,"H":41},"radius":20.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":151,"Y":268,"W":63,"H":63},"radius":31.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":226,"Y":268,"W":120,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":358,"Y":268,"W":121,"H":33},"radius":5,"color":[0.9607843,0.9607843,0.9607843,1]}],"triangles":null,"hits":null},"dialog":{"scene":"dialog","platform":"","width":640,"height":420,"dark":false,"texts":[{"value":"Hosts","bounds":{"X":24,"Y":24,"W":592,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":64.65},{"value":"A page behind a dialog, dimmed by the scrim.","bounds":{"X":24,"Y":67,"W":592,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":290.6},{"value":"New host","bounds":{"X":34,"Y":100,"W":80.81,"H":32},"size":14,"weight":0.15,"color":[0.9372549,0.9647059,1,1],"canvasWidth":60.81},{"value":"Import","bounds":{"X":122.81,"Y":100,"W":61.79,"H":32},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":41.79},{"value":"Delete host?","bounds":{"X":144,"Y":126,"W":352,"H":17},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"layer":12,"canvasWidth":91.47},{"value":"This removes the saved connection. It cannot be","bounds":{"X":144,"Y":151,"W":352,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"layer":12,"canvasWidth":309.37},{"value":"undone.","bounds":{"X":144,"Y":172,"W":352,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"layer":12,"canvasWidth":51.83},{"value":"web-01 (10.0.0.12)","bounds":{"X":144,"Y":217,"W":352,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"layer":12,"canvasWidth":116.94},{"value":"Cancel","bounds":{"X":372.04,"Y":262,"W":64.61,"H":32},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"layer":12,"canvasWidth":44.61},{"value":"Delete","bounds":{"X":444.66,"Y":262,"W":61.34,"H":32},"size":14,"weight":0.15,"color":[0.90588236,0,0.043137256,1],"layer":12,"canvasWidth":41.34}],"rectangles":[{"bounds":{"X":24,"Y":100,"W":81,"H":32},"radius":7.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":113,"Y":100,"W":62,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":114,"Y":101,"W":60,"H":30},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":0,"Y":0,"W":640,"H":420},"color":[0,0,0,0.4],"layer":12},{"bounds":{"X":120,"Y":102,"W":400,"H":216},"radius":11,"color":[0.8980392,0.8980392,0.8980392,1],"layer":12},{"bounds":{"X":121,"Y":103,"W":398,"H":214},"radius":10,"color":[1,1,1,1],"layer":12},{"bounds":{"X":472,"Y":118,"W":32,"H":32},"radius":7.5,"color":[1,1,1,0],"layer":12},{"bounds":{"X":360,"Y":260,"W":69,"H":36},"radius":9.5,"color":[0.6313726,0.6313726,0.6313726,0.5],"layer":12},{"bounds":{"X":362,"Y":262,"W":65,"H":32},"radius":7.5,"color":[0.6313726,0.6313726,0.6313726,1],"layer":12},{"bounds":{"X":363,"Y":263,"W":63,"H":30},"radius":6.5,"color":[1,1,1,1],"layer":12},{"bounds":{"X":435,"Y":262,"W":61,"H":32},"radius":7.5,"color":[0.90588236,0,0.043137256,0.1],"layer":12}],"triangles":[{"points":[[491.47,129.47],[483.47,137.47],[492.53,130.53]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492.53,130.53],[483.47,137.47],[484.53,138.53]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492.75,130],[492.65,130.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492.65,130.38],[492.38,130.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492.38,130.65],[492,130.75]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492,130.75],[491.63,130.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[491.63,130.65],[491.35,130.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[491.35,130.38],[491.25,130]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[491.25,130],[491.35,129.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[491.35,129.63],[491.63,129.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[491.63,129.35],[492,129.25]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492,129.25],[492.38,129.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492.38,129.35],[492.65,129.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,130],[492.65,129.63],[492.75,130]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484.75,138],[484.65,138.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484.65,138.38],[484.38,138.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484.38,138.65],[484,138.75]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484,138.75],[483.63,138.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[483.63,138.65],[483.35,138.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[483.35,138.38],[483.25,138]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[483.25,138],[483.35,137.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[483.35,137.63],[483.63,137.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[483.63,137.35],[484,137.25]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484,137.25],[484.38,137.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484.38,137.35],[484.65,137.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,138],[484.65,137.63],[484.75,138]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[483.47,130.53],[491.47,138.53],[484.53,129.47]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484.53,129.47],[491.47,138.53],[492.53,137.47]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484.75,130],[484.65,130.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484.65,130.38],[484.38,130.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484.38,130.65],[484,130.75]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484,130.75],[483.63,130.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[483.63,130.65],[483.35,130.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[483.35,130.38],[483.25,130]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[483.25,130],[483.35,129.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[483.35,129.63],[483.63,129.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[483.63,129.35],[484,129.25]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484,129.25],[484.38,129.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484.38,129.35],[484.65,129.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[484,130],[484.65,129.63],[484.75,130]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492.75,138],[492.65,138.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492.65,138.38],[492.38,138.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492.38,138.65],[492,138.75]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492,138.75],[491.63,138.65]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[491.63,138.65],[491.35,138.38]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[491.35,138.38],[491.25,138]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[491.25,138],[491.35,137.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[491.35,137.63],[491.63,137.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[491.63,137.35],[492,137.25]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492,137.25],[492.38,137.35]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492.38,137.35],[492.65,137.63]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12},{"points":[[492,138],[492.65,137.63],[492.75,138]],"color":[0.4509804,0.4509804,0.4509804,1],"layer":12}],"shadows":[{"bounds":{"X":113,"Y":100,"W":62,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":362,"Y":262,"W":65,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2,"layer":12}],"hits":[{"id":"parity/#0/#0/#16777216","bounds":{"X":24,"Y":100,"W":80.81,"H":32},"label":"New host","role":1},{"id":"parity/#0/#0/#16777217","bounds":{"X":112.81,"Y":100,"W":61.79,"H":32},"label":"Import","role":1},{"id":"parity/dismiss","bounds":{"X":0,"Y":0,"W":640,"H":420},"label":"Dismiss dialog","role":1,"layer":12},{"id":"none","bounds":{"X":120,"Y":102,"W":400,"H":216},"layer":12},{"id":"parity/close","bounds":{"X":472,"Y":118,"W":32,"H":32},"label":"Close dialog","role":1,"layer":12},{"id":"parity/#16777216","bounds":{"X":362.04,"Y":262,"W":64.61,"H":32},"label":"Cancel","role":1,"layer":12},{"id":"parity/#16777217","bounds":{"X":434.66,"Y":262,"W":61.34,"H":32},"label":"Delete","role":1,"layer":12}]},"form":{"scene":"form","platform":"","width":560,"height":640,"dark":false,"texts":[{"value":"New connection","bounds":{"X":24,"Y":24,"W":512,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":181.24},{"value":"Connect to a server over SSH with a key or a password.","bounds":{"X":24,"Y":69,"W":512,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":355.18},{"value":"Connect","bounds":{"X":34,"Y":104,"W":74.38,"H":32},"size":14,"weight":0.15,"color":[0.9372549,0.9647059,1,1],"canvasWidth":54.38},{"value":"Save","bounds":{"X":116.38,"Y":104,"W":51.93,"H":32},"size":14,"weight":0.15,"color":[0.09411765,0.09411765,0.105882354,1],"canvasWidth":31.93},{"value":"Cancel","bounds":{"X":176.31,"Y":104,"W":64.61,"H":32},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":44.61},{"value":"Help","bounds":{"X":248.92,"Y":104,"W":49.59,"H":32},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.59},{"value":"Delete","bounds":{"X":306.51,"Y":104,"W":61.34,"H":32},"size":14,"weight":0.15,"color":[0.90588236,0,0.043137256,1],"canvasWidth":41.34},{"value":"Small","bounds":{"X":34,"Y":154,"W":55.01,"H":28},"size":14,"weight":0.15,"color":[0.9372549,0.9647059,1,1],"canvasWidth":35.01},{"value":"Default","bounds":{"X":97.01,"Y":152,"W":66.37,"H":32},"size":14,"weight":0.15,"color":[0.9372549,0.9647059,1,1],"canvasWidth":46.37},{"value":"Large","bounds":{"X":171.38,"Y":150,"W":56.65,"H":36},"size":14,"weight":0.15,"color":[0.9372549,0.9647059,1,1],"canvasWidth":36.65},{"value":"Keep alive","bounds":{"X":88,"Y":206.7,"W":49.33,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":88,"Y":206.7,"W":49.329086,"H":21},"canvasWidth":66.15},{"value":"Compression","bounds":{"X":225.33,"Y":206.7,"W":65.06,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":225.32909,"Y":206.7,"W":65.06122,"H":21},"canvasWidth":84.22},{"value":"Agent forwarding","bounds":{"X":362.39,"Y":206.7,"W":90.31,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":362.39032,"Y":206.7,"W":90.30783,"H":21},"canvasWidth":110.84},{"value":"X11","bounds":{"X":524.7,"Y":206.7,"W":11.3,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":524.6981,"Y":206.7,"W":11.301872,"H":21},"canvasWidth":20.1},{"value":"Ada Lovelace","bounds":{"X":35,"Y":254.4,"W":490,"H":20},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":35,"Y":248.4,"W":490,"H":32},"canvasWidth":86.19},{"value":"hostname or address","bounds":{"X":35,"Y":300.4,"W":490,"H":20},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"clip":{"X":35,"Y":294.4,"W":490,"H":32},"canvasWidth":134.37},{"value":"Password","bounds":{"X":77.59,"Y":340.4,"W":170.67,"H":32},"size":14,"weight":0.15,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":63.49},{"value":"Key","bounds":{"X":267.57,"Y":340.4,"W":170.67,"H":32},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":24.87},{"value":"Agent","bounds":{"X":431.46,"Y":340.4,"W":170.67,"H":32},"size":14,"weight":0.15,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":38.41},{"value":"OpenSSH","bounds":{"X":35,"Y":386.4,"W":178,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":61.51}],"rectangles":[{"bounds":{"X":24,"Y":104,"W":74,"H":32},"radius":7.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":106,"Y":104,"W":52,"H":32},"radius":7.5,"color":[0.95686275,0.95686275,0.9607843,1]},{"bounds":{"X":166,"Y":104,"W":65,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":167,"Y":105,"W":63,"H":30},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":297,"Y":104,"W":61,"H":32},"radius":7.5,"color":[0.90588236,0,0.043137256,0.1]},{"bounds":{"X":24,"Y":154,"W":55,"H":28},"radius":7.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":87,"Y":152,"W":66,"H":32},"radius":7.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":161,"Y":150,"W":57,"H":36},"radius":7.5,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":36,"Y":208,"W":32,"H":18},"radius":9.2,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":51,"Y":209,"W":16,"H":16},"radius":8,"color":[1,1,1,1]},{"bounds":{"X":173,"Y":208,"W":32,"H":18},"radius":9.2,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":174,"Y":209,"W":16,"H":16},"radius":8,"color":[1,1,1,1]},{"bounds":{"X":326,"Y":209,"W":16,"H":16},"radius":4,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":327,"Y":210,"W":14,"H":14},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":489,"Y":209,"W":16,"H":16},"radius":4,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":490,"Y":210,"W":14,"H":14},"radius":3,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":248,"W":512,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":249,"W":510,"H":30},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":294,"W":512,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":295,"W":510,"H":30},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":340,"W":512,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":341,"W":510,"H":30},"radius":6.5,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":26,"Y":342,"W":167,"H":28},"radius":5.5,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":197,"Y":342,"W":167,"H":28},"radius":5.5,"color":[1,1,1,1]},{"bounds":{"X":367,"Y":342,"W":167,"H":28},"radius":5.5,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":194,"Y":349,"W":1,"H":14},"color":[0.8980392,0.8980392,0.8980392,0]},{"bounds":{"X":365,"Y":349,"W":1,"H":14},"color":[0.8980392,0.8980392,0.8980392,0]},{"bounds":{"X":24,"Y":386,"W":220,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":387,"W":218,"H":30},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":437,"W":512,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":437,"W":182,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":198,"Y":432,"W":16,"H":16},"radius":8,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":199,"Y":433,"W":14,"H":14},"radius":7,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":462,"W":512,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":462,"W":512,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1],"clip":{"X":24,"Y":462.4,"W":307.2,"H":6}}],"triangles":[{"points":[[338.14,213.26],[331.72,219.68],[339.2,214.32]],"color":[0.9372549,0.9647059,1,1]},{"points":[[339.2,214.32],[331.72,219.68],[332.78,220.74]],"color":[0.9372549,0.9647059,1,1]},{"points":[[332.78,219.68],[329.86,216.76],[331.72,220.74]],"color":[0.9372549,0.9647059,1,1]},{"points":[[331.72,220.74],[329.86,216.76],[328.8,217.82]],"color":[0.9372549,0.9647059,1,1]},{"points":[[332.25,220.21],[332.78,220.74],[332.25,220.96]],"color":[0.9372549,0.9647059,1,1]},{"points":[[332.25,220.21],[332.25,220.96],[331.72,220.74]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[339.42,213.79],[339.32,214.17]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[339.32,214.17],[339.04,214.44]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[339.04,214.44],[338.67,214.54]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[338.67,214.54],[338.29,214.44]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[338.29,214.44],[338.02,214.17]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[338.02,214.17],[337.92,213.79]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[337.92,213.79],[338.02,213.42]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[338.02,213.42],[338.29,213.14]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[338.29,213.14],[338.67,213.04]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[338.67,213.04],[339.04,213.14]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[339.04,213.14],[339.32,213.42]],"color":[0.9372549,0.9647059,1,1]},{"points":[[338.67,213.79],[339.32,213.42],[339.42,213.79]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[330.08,217.29],[329.98,217.67]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[329.98,217.67],[329.71,217.94]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[329.71,217.94],[329.33,218.04]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[329.33,218.04],[328.96,217.94]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[328.96,217.94],[328.68,217.67]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[328.68,217.67],[328.58,217.29]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[328.58,217.29],[328.68,216.92]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[328.68,216.92],[328.96,216.64]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[328.96,216.64],[329.33,216.54]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[329.33,216.54],[329.71,216.64]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[329.71,216.64],[329.98,216.92]],"color":[0.9372549,0.9647059,1,1]},{"points":[[329.33,217.29],[329.98,216.92],[330.08,217.29]],"color":[0.9372549,0.9647059,1,1]},{"points":[[222.47,400.53],[226.47,404.53],[223.53,399.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223.53,399.47],[226.47,404.53],[227.53,403.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[227.53,404.53],[231.53,400.53],[226.47,403.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[226.47,403.47],[231.53,400.53],[230.47,399.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[227,404],[226.47,404.53],[227,404.75]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[227,404],[227,404.75],[227.53,404.53]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223.75,400],[223.65,400.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223.65,400.38],[223.38,400.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223.38,400.65],[223,400.75]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223,400.75],[222.63,400.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[222.63,400.65],[222.35,400.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[222.35,400.38],[222.25,400]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[222.25,400],[222.35,399.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[222.35,399.63],[222.63,399.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[222.63,399.35],[223,399.25]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223,399.25],[223.38,399.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223.38,399.35],[223.65,399.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[223,400],[223.65,399.63],[223.75,400]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231.75,400],[231.65,400.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231.65,400.38],[231.38,400.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231.38,400.65],[231,400.75]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231,400.75],[230.63,400.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[230.63,400.65],[230.35,400.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[230.35,400.38],[230.25,400]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[230.25,400],[230.35,399.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[230.35,399.63],[230.63,399.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[230.63,399.35],[231,399.25]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231,399.25],[231.38,399.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231.38,399.35],[231.65,399.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[231,400],[231.65,399.63],[231.75,400]],"color":[0.4509804,0.4509804,0.4509804,1]}],"shadows":[{"bounds":{"X":166,"Y":104,"W":65,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":36,"Y":208,"W":32,"H":18},"radius":9.2,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":173,"Y":208,"W":32,"H":18},"radius":9.2,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":326,"Y":209,"W":16,"H":16},"radius":4,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":489,"Y":209,"W":16,"H":16},"radius":4,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":24,"Y":248,"W":512,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":24,"Y":294,"W":512,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":24,"Y":386,"W":220,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":198,"Y":432,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":198,"Y":432,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1}],"hits":[{"id":"parity/#0/#0/#16777216","bounds":{"X":24,"Y":104,"W":74.38,"H":32},"label":"Connect","role":1},{"id":"parity/#0/#0/#16777217","bounds":{"X":106.38,"Y":104,"W":51.93,"H":32},"label":"Save","role":1},{"id":"parity/#0/#0/#16777218","bounds":{"X":166.31,"Y":104,"W":64.61,"H":32},"label":"Cancel","role":1},{"id":"parity/#0/#0/#16777219","bounds":{"X":238.92,"Y":104,"W":49.59,"H":32},"label":"Help","role":1},{"id":"parity/#0/#0/#16777220","bounds":{"X":296.51,"Y":104,"W":61.34,"H":32},"label":"Delete","role":1},{"id":"parity/#0/#1/#16777216","bounds":{"X":24,"Y":154,"W":55.01,"H":28},"label":"Small","role":1},{"id":"parity/#0/#1/#16777217","bounds":{"X":87.01,"Y":152,"W":66.37,"H":32},"label":"Default","role":1},{"id":"parity/#0/#1/#16777218","bounds":{"X":161.38,"Y":150,"W":56.65,"H":36},"label":"Large","role":1},{"id":"parity/#0/#2/#0/#50331648","bounds":{"X":24,"Y":200,"W":56,"H":34.4},"label":"switch","role":8},{"id":"parity/#0/#2/#1/#50331648","bounds":{"X":161.33,"Y":200,"W":56,"H":34.4},"label":"switch","role":8},{"id":"parity/#0/#2/#2/#33554432","bounds":{"X":314.39,"Y":201.2,"W":40,"H":32},"label":"checkbox","role":3},{"id":"parity/#0/#2/#3/#33554432","bounds":{"X":476.7,"Y":201.2,"W":40,"H":32},"label":"checkbox","role":3},{"id":"parity/#0/#83886080","bounds":{"X":24,"Y":248.4,"W":512,"H":32},"label":"Name","role":9},{"id":"parity/#0/#83886081","bounds":{"X":24,"Y":294.4,"W":512,"H":32},"label":"Host","role":9},{"id":"parity/#0/#67108864/#0","bounds":{"X":24,"Y":340.4,"W":170.67,"H":32},"label":"Password","role":4},{"id":"parity/#0/#67108864/#1","bounds":{"X":194.67,"Y":340.4,"W":170.67,"H":32},"label":"Key","role":4},{"id":"parity/#0/#67108864/#2","bounds":{"X":365.33,"Y":340.4,"W":170.67,"H":32},"label":"Agent","role":4},{"id":"parity/#0/#167772160/#3","bounds":{"X":24,"Y":386.4,"W":220,"H":32},"label":"Client","role":7},{"id":"parity/#0/#184549376","bounds":{"X":24,"Y":432.4,"W":512,"H":16},"label":"Slider","role":10}]},"list-clip":{"scene":"list-clip","platform":"","width":360,"height":300,"dark":false,"texts":[{"value":"Recent","bounds":{"X":24,"Y":24,"W":312,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":45.47},{"value":"session-00.log","bounds":{"X":57,"Y":29,"W":94.94,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.94},{"value":"session-01.log","bounds":{"X":57,"Y":66,"W":91.93,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":91.93},{"value":"session-02.log","bounds":{"X":57,"Y":103,"W":94.66,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.66},{"value":"session-03.log","bounds":{"X":57,"Y":140,"W":94.76,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.76},{"value":"session-04.log","bounds":{"X":57,"Y":177,"W":95.14,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":95.14},{"value":"session-05.log","bounds":{"X":57,"Y":214,"W":94.63,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.63},{"value":"session-06.log","bounds":{"X":57,"Y":251,"W":94.79,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.79},{"value":"session-07.log","bounds":{"X":57,"Y":288,"W":94.07,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.07},{"value":"session-08.log","bounds":{"X":57,"Y":325,"W":94.77,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":24,"Y":57,"W":312,"H":180},"canvasWidth":94.77}],"rectangles":[{"bounds":{"X":24,"Y":57,"W":312,"H":180},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":25,"Y":58,"W":310,"H":178},"radius":6.5,"color":[1,1,1,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":32,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":69,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":106,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":143,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":180,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":217,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":254,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":291,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}},{"bounds":{"X":33,"Y":328,"W":16,"H":16},"radius":4,"color":[0.9607843,0.9607843,0.9607843,1],"clip":{"X":24,"Y":57,"W":312,"H":180}}],"triangles":null,"hits":null},"progress-slider":{"scene":"progress-slider","platform":"","width":480,"height":420,"dark":false,"texts":null,"rectangles":[{"bounds":{"X":24,"Y":24,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":44,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":44,"W":432,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1],"clip":{"X":24,"Y":44,"W":142.56001,"H":6}},{"bounds":{"X":24,"Y":64,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":64,"W":432,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1],"clip":{"X":24,"Y":64,"W":285.12003,"H":6}},{"bounds":{"X":24,"Y":84,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":84,"W":432,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1],"clip":{"X":24,"Y":84,"W":432,"H":6}},{"bounds":{"X":24,"Y":109,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":109,"W":8,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":24,"Y":104,"W":16,"H":16},"radius":8,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":25,"Y":105,"W":14,"H":14},"radius":7,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":139,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":139,"W":112,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":128,"Y":134,"W":16,"H":16},"radius":8,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":129,"Y":135,"W":14,"H":14},"radius":7,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":169,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":169,"W":216,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":232,"Y":164,"W":16,"H":16},"radius":8,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":233,"Y":165,"W":14,"H":14},"radius":7,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":199,"W":432,"H":6},"radius":3,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":199,"W":432,"H":6},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":440,"Y":194,"W":16,"H":16},"radius":8,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":441,"Y":195,"W":14,"H":14},"radius":7,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":224,"W":432,"H":12},"radius":6,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":224,"W":432,"H":12},"radius":6,"color":[0.078431375,0.2784314,0.9019608,1],"clip":{"X":24,"Y":224,"W":216,"H":12}},{"bounds":{"X":29,"Y":250,"W":6,"H":120},"radius":60,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":29,"Y":320,"W":6,"H":50},"radius":3,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":24,"Y":312,"W":16,"H":16},"radius":8,"color":[0.078431375,0.2784314,0.9019608,1]},{"bounds":{"X":25,"Y":313,"W":14,"H":14},"radius":7,"color":[1,1,1,1]}],"triangles":null,"shadows":[{"bounds":{"X":24,"Y":104,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":24,"Y":104,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1},{"bounds":{"X":128,"Y":134,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":128,"Y":134,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1},{"bounds":{"X":232,"Y":164,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":232,"Y":164,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1},{"bounds":{"X":440,"Y":194,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":440,"Y":194,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1},{"bounds":{"X":24,"Y":312,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":24,"Y":312,"W":16,"H":16},"radius":8,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1}],"hits":[{"id":"parity/#0/#184549376","bounds":{"X":24,"Y":104,"W":432,"H":16},"label":"Slider","role":10},{"id":"parity/#0/#184549377","bounds":{"X":24,"Y":134,"W":432,"H":16},"label":"Slider","role":10},{"id":"parity/#0/#184549378","bounds":{"X":24,"Y":164,"W":432,"H":16},"label":"Slider","role":10},{"id":"parity/#0/#184549379","bounds":{"X":24,"Y":194,"W":432,"H":16},"label":"Slider","role":10},{"id":"parity/#0/#0/#184549376","bounds":{"X":24,"Y":250,"W":16,"H":120},"label":"Slider","role":10}]},"select-open":{"scene":"select-open","platform":"","width":420,"height":320,"dark":false,"texts":[{"value":"Shell","bounds":{"X":24,"Y":24,"W":372,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":31.96},{"value":"bash","bounds":{"X":35,"Y":57,"W":198,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":30.82},{"value":"zsh","bounds":{"X":36,"Y":97,"W":192,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"layer":11,"canvasWidth":22.47},{"value":"bash","bounds":{"X":36,"Y":129,"W":192,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"layer":11,"canvasWidth":30.82},{"value":"fish","bounds":{"X":36,"Y":161,"W":192,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"layer":11,"canvasWidth":23.28},{"value":"PowerShell","bounds":{"X":36,"Y":193,"W":192,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"layer":11,"canvasWidth":71.45},{"value":"cmd","bounds":{"X":36,"Y":225,"W":192,"H":32},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"layer":11,"canvasWidth":27.68}],"rectangles":[{"bounds":{"X":24,"Y":57,"W":240,"H":32},"radius":7.5,"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":25,"Y":58,"W":238,"H":30},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":24,"Y":93,"W":240,"H":168},"radius":10,"color":[0.8980392,0.8980392,0.8980392,1],"layer":11},{"bounds":{"X":25,"Y":94,"W":238,"H":166},"radius":9,"color":[1,1,1,1],"layer":11}],"triangles":[{"points":[[242.47,71.53],[246.47,75.53],[243.53,70.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243.53,70.47],[246.47,75.53],[247.53,74.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[247.53,75.53],[251.53,71.53],[246.47,74.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[246.47,74.47],[251.53,71.53],[250.47,70.47]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[247,75],[246.47,75.53],[247,75.75]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[247,75],[247,75.75],[247.53,75.53]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243.75,71],[243.65,71.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243.65,71.38],[243.38,71.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243.38,71.65],[243,71.75]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243,71.75],[242.63,71.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[242.63,71.65],[242.35,71.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[242.35,71.38],[242.25,71]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[242.25,71],[242.35,70.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[242.35,70.63],[242.63,70.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[242.63,70.35],[243,70.25]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243,70.25],[243.38,70.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243.38,70.35],[243.65,70.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[243,71],[243.65,70.63],[243.75,71]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251.75,71],[251.65,71.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251.65,71.38],[251.38,71.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251.38,71.65],[251,71.75]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251,71.75],[250.63,71.65]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[250.63,71.65],[250.35,71.38]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[250.35,71.38],[250.25,71]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[250.25,71],[250.35,70.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[250.35,70.63],[250.63,70.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[250.63,70.35],[251,70.25]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251,70.25],[251.38,70.35]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251.38,70.35],[251.65,70.63]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[251,71],[251.65,70.63],[251.75,71]],"color":[0.4509804,0.4509804,0.4509804,1]},{"points":[[247.14,141.26],[240.72,147.68],[248.2,142.32]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[248.2,142.32],[240.72,147.68],[241.78,148.74]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[241.78,147.68],[238.86,144.76],[240.72,148.74]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[240.72,148.74],[238.86,144.76],[237.8,145.82]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[241.25,148.21],[241.78,148.74],[241.25,148.96]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[241.25,148.21],[241.25,148.96],[240.72,148.74]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[248.42,141.79],[248.32,142.17]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[248.32,142.17],[248.04,142.44]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[248.04,142.44],[247.67,142.54]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[247.67,142.54],[247.29,142.44]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[247.29,142.44],[247.02,142.17]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[247.02,142.17],[246.92,141.79]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[246.92,141.79],[247.02,141.42]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[247.02,141.42],[247.29,141.14]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[247.29,141.14],[247.67,141.04]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[247.67,141.04],[248.04,141.14]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[248.04,141.14],[248.32,141.42]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[247.67,141.79],[248.32,141.42],[248.42,141.79]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[239.08,145.29],[238.98,145.67]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[238.98,145.67],[238.71,145.94]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[238.71,145.94],[238.33,146.04]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[238.33,146.04],[237.96,145.94]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[237.96,145.94],[237.68,145.67]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[237.68,145.67],[237.58,145.29]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[237.58,145.29],[237.68,144.92]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[237.68,144.92],[237.96,144.64]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[237.96,144.64],[238.33,144.54]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[238.33,144.54],[238.71,144.64]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[238.71,144.64],[238.98,144.92]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11},{"points":[[238.33,145.29],[238.98,144.92],[239.08,145.29]],"color":[0.039215688,0.039215688,0.039215688,1],"layer":11}],"shadows":[{"bounds":{"X":24,"Y":57,"W":240,"H":32},"radius":7.5,"color":[0,0,0,0.05],"offsetY":1,"blur":2},{"bounds":{"X":24,"Y":93,"W":240,"H":168},"radius":10,"color":[0,0,0,0.1],"offsetY":4,"blur":6,"spread":-1,"layer":11},{"bounds":{"X":24,"Y":93,"W":240,"H":168},"radius":10,"color":[0,0,0,0.1],"offsetY":2,"blur":4,"spread":-2,"layer":11}],"hits":[{"id":"parity/#0/#167772160/#5","bounds":{"X":24,"Y":57,"W":240,"H":32},"label":"Shell","role":7},{"id":"parity/#0/#167772160/#6","bounds":{"X":0,"Y":0,"W":420,"H":320},"label":"Dismiss select","role":1,"layer":11},{"id":"none","bounds":{"X":24,"Y":93,"W":240,"H":168},"layer":11},{"id":"none","bounds":{"X":24,"Y":93,"W":240,"H":168},"label":"Shell","role":15,"layer":11},{"id":"parity/#0/#167772160/#0","bounds":{"X":28,"Y":97,"W":232,"H":32},"label":"zsh","role":16,"layer":11},{"id":"parity/#0/#167772160/#1","bounds":{"X":28,"Y":129,"W":232,"H":32},"label":"bash","role":16,"layer":11},{"id":"parity/#0/#167772160/#2","bounds":{"X":28,"Y":161,"W":232,"H":32},"label":"fish","role":16,"layer":11},{"id":"parity/#0/#167772160/#3","bounds":{"X":28,"Y":193,"W":232,"H":32},"label":"PowerShell","role":16,"layer":11},{"id":"parity/#0/#167772160/#4","bounds":{"X":28,"Y":225,"W":232,"H":32},"label":"cmd","role":16,"layer":11}]},"table":{"scene":"table","platform":"","width":560,"height":360,"dark":false,"texts":[{"value":"Servers","bounds":{"X":24,"Y":24,"W":512,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":86.71},{"value":"Name","bounds":{"X":32,"Y":67,"W":184,"H":40},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":67,"W":184,"H":40},"canvasWidth":37.63},{"value":"State","bounds":{"X":232,"Y":67,"W":104,"H":40},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":67,"W":104,"H":40},"canvasWidth":33.35},{"value":"Latency","bounds":{"X":476.72,"Y":67,"W":51.28,"H":40},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":67,"W":176,"H":40},"canvasWidth":51.28},{"value":"↑","bounds":{"X":273.59,"Y":67,"W":12,"H":40},"size":14,"weight":0.15,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":11.53},{"value":"web-01","bounds":{"X":32,"Y":107,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":107,"W":184,"H":36},"canvasWidth":47.19},{"value":"Running","bounds":{"X":232,"Y":107,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":107,"W":104,"H":36},"canvasWidth":51.93},{"value":"12 ms","bounds":{"X":491.69,"Y":107,"W":36.31,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":107,"W":176,"H":36},"canvasWidth":36.31},{"value":"web-02","bounds":{"X":32,"Y":143,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":143,"W":184,"H":36},"canvasWidth":49.92},{"value":"Running","bounds":{"X":232,"Y":143,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":143,"W":104,"H":36},"canvasWidth":51.93},{"value":"9 ms","bounds":{"X":497.02,"Y":143,"W":30.98,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":143,"W":176,"H":36},"canvasWidth":30.98},{"value":"db-primary","bounds":{"X":32,"Y":179,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":179,"W":184,"H":36},"canvasWidth":71.11},{"value":"Degraded","bounds":{"X":232,"Y":179,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":179,"W":104,"H":36},"canvasWidth":62.68},{"value":"48 ms","bounds":{"X":488.36,"Y":179,"W":39.64,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":179,"W":176,"H":36},"canvasWidth":39.64},{"value":"db-replica","bounds":{"X":32,"Y":215,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":215,"W":184,"H":36},"canvasWidth":65.5},{"value":"Running","bounds":{"X":232,"Y":215,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":215,"W":104,"H":36},"canvasWidth":51.93},{"value":"15 ms","bounds":{"X":491.71,"Y":215,"W":36.29,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":215,"W":176,"H":36},"canvasWidth":36.29},{"value":"cache","bounds":{"X":32,"Y":251,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":251,"W":184,"H":36},"canvasWidth":38.68},{"value":"Stopped","bounds":{"X":232,"Y":251,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":251,"W":104,"H":36},"canvasWidth":53.6},{"value":"-","bounds":{"X":521.82,"Y":251,"W":6.18,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":251,"W":176,"H":36},"canvasWidth":6.18},{"value":"build-agent-long-name","bounds":{"X":32,"Y":287,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":287,"W":184,"H":36},"canvasWidth":148.02},{"value":"Running","bounds":{"X":232,"Y":287,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":287,"W":104,"H":36},"canvasWidth":51.93},{"value":"103 ms","bounds":{"X":483.11,"Y":287,"W":44.89,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":287,"W":176,"H":36},"canvasWidth":44.89},{"value":"监控服务器","bounds":{"X":32,"Y":323,"W":184,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":32,"Y":323,"W":184,"H":36},"canvasWidth":70},{"value":"运行中","bounds":{"X":232,"Y":323,"W":104,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":232,"Y":323,"W":104,"H":36},"canvasWidth":42},{"value":"7 ms","bounds":{"X":497.74,"Y":323,"W":30.26,"H":36},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":352,"Y":323,"W":176,"H":36},"canvasWidth":30.26}],"rectangles":[{"bounds":{"X":24,"Y":106,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":24,"Y":142,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":24,"Y":178,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":24,"Y":179,"W":512,"H":36},"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":24,"Y":214,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":24,"Y":250,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":24,"Y":286,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]},{"bounds":{"X":24,"Y":322,"W":512,"H":1},"color":[0.8980392,0.8980392,0.8980392,1]}],"triangles":null,"hits":[{"id":"parity/heads/#0","bounds":{"X":24,"Y":67,"W":200,"H":40},"label":"Name","role":1},{"id":"parity/heads/#1","bounds":{"X":224,"Y":67,"W":120,"H":40},"label":"State","role":1},{"id":"parity/heads/#2","bounds":{"X":344,"Y":67,"W":192,"H":40},"label":"Latency","role":1},{"id":"parity/rows/#0","bounds":{"X":24,"Y":107,"W":512,"H":36},"label":"web-01","role":1},{"id":"parity/rows/#1","bounds":{"X":24,"Y":143,"W":512,"H":36},"label":"web-02","role":1},{"id":"parity/rows/#2","bounds":{"X":24,"Y":179,"W":512,"H":36},"label":"db-primary","role":1},{"id":"parity/rows/#3","bounds":{"X":24,"Y":215,"W":512,"H":36},"label":"db-replica","role":1},{"id":"parity/rows/#4","bounds":{"X":24,"Y":251,"W":512,"H":36},"label":"cache","role":1},{"id":"parity/rows/#5","bounds":{"X":24,"Y":287,"W":512,"H":36},"label":"build-agent-long-name","role":1},{"id":"parity/rows/#6","bounds":{"X":24,"Y":323,"W":512,"H":36},"label":"监控服务器","role":1}]},"tabs":{"scene":"tabs","platform":"","width":520,"height":300,"dark":false,"texts":[{"value":"General","bounds":{"X":79.6,"Y":27,"W":155.33,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,0.6],"clip":{"X":27,"Y":27,"W":155.33333,"H":30},"canvasWidth":50.13},{"value":"Keys","bounds":{"X":243.95,"Y":27,"W":155.33,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":182.33333,"Y":27,"W":155.33333,"H":30},"canvasWidth":32.11},{"value":"Advanced","bounds":{"X":382.72,"Y":27,"W":155.33,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,0.6],"clip":{"X":337.66666,"Y":27,"W":155.33333,"H":30},"canvasWidth":65.24},{"value":"Keys are read from ~/.ssh and the agent.","bounds":{"X":24,"Y":76,"W":472,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":260.43},{"value":"Overview","bounds":{"X":53.12,"Y":116,"W":113.5,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,0.6],"clip":{"X":27,"Y":116,"W":113.5,"H":30},"canvasWidth":61.26},{"value":"Files","bounds":{"X":186.34,"Y":116,"W":113.5,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,0.6],"clip":{"X":144.5,"Y":116,"W":113.5,"H":30},"canvasWidth":29.83},{"value":"Terminal","bounds":{"X":290.61,"Y":116,"W":113.5,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":262,"Y":116,"W":113.5,"H":30},"canvasWidth":56.29},{"value":"Monitor","bounds":{"X":411.38,"Y":116,"W":113.5,"H":30},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,0.6],"clip":{"X":379.5,"Y":116,"W":113.5,"H":30},"canvasWidth":49.75},{"value":"A line variant with an underline.","bounds":{"X":24,"Y":170,"W":472,"H":21},"size":14,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":199.01}],"rectangles":[{"bounds":{"X":24,"Y":24,"W":472,"H":36},"radius":9.5,"color":[0.9607843,0.9607843,0.9607843,1]},{"bounds":{"X":27,"Y":27,"W":155,"H":30},"radius":7.5,"color":[1,1,1,0]},{"bounds":{"X":27,"Y":60,"W":155,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,0]},{"bounds":{"X":182,"Y":27,"W":155,"H":30},"radius":7.5,"color":[1,1,1,1]},{"bounds":{"X":183,"Y":28,"W":153,"H":28},"radius":6.5,"color":[1,1,1,1]},{"bounds":{"X":182,"Y":60,"W":155,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,0]},{"bounds":{"X":338,"Y":27,"W":155,"H":30},"radius":7.5,"color":[1,1,1,0]},{"bounds":{"X":338,"Y":60,"W":155,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,0]},{"bounds":{"X":24,"Y":113,"W":472,"H":36},"color":[1,1,1,0]},{"bounds":{"X":27,"Y":116,"W":114,"H":30},"radius":7.5,"color":[1,1,1,0]},{"bounds":{"X":27,"Y":149,"W":114,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,0]},{"bounds":{"X":145,"Y":116,"W":114,"H":30},"radius":7.5,"color":[1,1,1,0]},{"bounds":{"X":145,"Y":149,"W":114,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,0]},{"bounds":{"X":262,"Y":116,"W":114,"H":30},"radius":7.5,"color":[1,1,1,0]},{"bounds":{"X":262,"Y":149,"W":114,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,1]},{"bounds":{"X":380,"Y":116,"W":114,"H":30},"radius":7.5,"color":[1,1,1,0]},{"bounds":{"X":380,"Y":149,"W":114,"H":2},"radius":1,"color":[0.039215688,0.039215688,0.039215688,0]}],"triangles":null,"shadows":[{"bounds":{"X":182,"Y":27,"W":155,"H":30},"radius":7.5,"color":[0,0,0,0.1],"offsetY":1,"blur":3},{"bounds":{"X":182,"Y":27,"W":155,"H":30},"radius":7.5,"color":[0,0,0,0.1],"offsetY":1,"blur":2,"spread":-1}],"hits":[{"id":"parity/#0/#150994944/#0","bounds":{"X":27,"Y":27,"W":155.33,"H":30},"label":"General","role":5},{"id":"parity/#0/#150994944/#1","bounds":{"X":182.33,"Y":27,"W":155.33,"H":30},"label":"Keys","role":5},{"id":"parity/#0/#150994944/#2","bounds":{"X":337.67,"Y":27,"W":155.33,"H":30},"label":"Advanced","role":5},{"id":"parity/#0/#150994945/#0","bounds":{"X":27,"Y":116,"W":113.5,"H":30},"label":"Overview","role":5},{"id":"parity/#0/#150994945/#1","bounds":{"X":144.5,"Y":116,"W":113.5,"H":30},"label":"Files","role":5},{"id":"parity/#0/#150994945/#2","bounds":{"X":262,"Y":116,"W":113.5,"H":30},"label":"Terminal","role":5},{"id":"parity/#0/#150994945/#3","bounds":{"X":379.5,"Y":116,"W":113.5,"H":30},"label":"Monitor","role":5}]},"text-bidi":{"scene":"text-bidi","platform":"","width":880,"height":640,"dark":false,"texts":[{"value":"The word שלום means peace in Hebrew.","bounds":{"X":16,"Y":16,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":238.76},{"value":"מחיר: 42.50 USD (כולל מע״מ) לכל יחידה","bounds":{"X":347.87,"Y":40,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":228.13},{"value":"اسم المستخدم: admin و كلمة المرور: 12345","bounds":{"X":341.02,"Y":64,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":234.98},{"value":"Connect to שרת-01 (192.168.1.1) failed: חיבור נכשל!","bounds":{"X":16,"Y":88,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":295.59},{"value":"(שלום) [עולם] {טוב} «abc» \u003cx\u003e","bounds":{"X":397.52,"Y":112,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":178.48},{"value":"בדיקה 123 של מספרים 4.5% ו-$7","bounds":{"X":386.67,"Y":136,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":189.33},{"value":"النسخة 2.0.1 من التطبيق متوفرة الآن","bounds":{"X":369.82,"Y":160,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":206.18},{"value":"‏hello world! (RLM first)","bounds":{"X":442.17,"Y":184,"W":560,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":133.83},{"value":"The word שלום means peace in Hebrew.","bounds":{"X":16,"Y":208,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":293.86},{"value":"מחיר: 42.50 USD (כולל מע״מ) לכל יחידה","bounds":{"X":295.22,"Y":235,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":280.78},{"value":"اسم المستخدم: admin و كلمة المرور: 12345","bounds":{"X":286.79,"Y":262,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":289.21},{"value":"Connect to שרת-01 (192.168.1.1) failed: חיבור נכשל!","bounds":{"X":16,"Y":289,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":363.8},{"value":"(שלום) [עולם] {טוב} «abc» \u003cx\u003e","bounds":{"X":356.33,"Y":316,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":219.67},{"value":"בדיקה 123 של מספרים 4.5% ו-$7","bounds":{"X":342.98,"Y":343,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":233.02},{"value":"النسخة 2.0.1 من التطبيق متوفرة الآن","bounds":{"X":322.23,"Y":370,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":253.77},{"value":"‏hello world! (RLM first)","bounds":{"X":411.28,"Y":397,"W":560,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":164.72},{"value":"end-aligned","bounds":{"X":16,"Y":424,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":60.1},{"value":"The word שלום means peace in Hebrew.","bounds":{"X":318.87,"Y":446,"W":560,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":257.13},{"value":"מחיר: 42.50 USD (כולל מע״מ) לכל יחידה","bounds":{"X":16,"Y":471,"W":560,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":245.68},{"value":"اسم المستخدم: admin و كلمة المرور: 12345","bounds":{"X":16,"Y":496,"W":560,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":253.06}],"rectangles":null,"triangles":null,"hits":null},"text-cjk":{"scene":"text-cjk","platform":"","width":880,"height":560,"dark":false,"texts":[{"value":"12 regular 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":16,"W":848,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":402.44},{"value":"12 medium 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":37,"W":848,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":407.41},{"value":"12 semibold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":58,"W":848,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":413.49},{"value":"12 bold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":79,"W":848,"H":19},"size":12,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":386.58},{"value":"14 regular 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":100,"W":848,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":470},{"value":"14 medium 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":123,"W":848,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":475.85},{"value":"14 semibold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":146,"W":848,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":482.98},{"value":"14 bold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":169,"W":848,"H":21},"size":14,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":451.64},{"value":"16 regular 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":192,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":536.74},{"value":"16 medium 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":217,"W":848,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":543.42},{"value":"16 semibold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":242,"W":848,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":551.58},{"value":"16 bold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":267,"W":848,"H":23},"size":16,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":515.75},{"value":"20 regular 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":292,"W":848,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":675.03},{"value":"20 medium 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":321,"W":848,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":683.45},{"value":"20 semibold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":350,"W":848,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":693.7},{"value":"20 bold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":379,"W":848,"H":27},"size":20,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":648.97},{"value":"24 regular 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":408,"W":848,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":810.39},{"value":"24 medium 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":441,"W":848,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":820.38},{"value":"24 semibold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":474,"W":848,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":832.58},{"value":"24 bold 界面一致性测试。你好,世界!日本語のテキスト 한국어 텍스트","bounds":{"X":16,"Y":507,"W":848,"H":31},"size":24,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":778.82}],"rectangles":null,"triangles":null,"hits":null},"text-emoji":{"scene":"text-emoji","platform":"","width":880,"height":560,"dark":false,"texts":[{"value":"12 regular 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":16,"W":848,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":193.4},{"value":"12 medium 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":37,"W":848,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":197.7},{"value":"12 semibold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":58,"W":848,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":203.09},{"value":"12 bold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":79,"W":848,"H":19},"size":12,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":175.51},{"value":"14 regular 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":100,"W":848,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":226.12},{"value":"14 medium 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":123,"W":848,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":231.18},{"value":"14 semibold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":146,"W":848,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":237.51},{"value":"14 bold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":169,"W":848,"H":21},"size":14,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":205.39},{"value":"16 regular 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":192,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":258.02},{"value":"16 medium 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":217,"W":848,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":263.8},{"value":"16 semibold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":242,"W":848,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":271.05},{"value":"16 bold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":267,"W":848,"H":23},"size":16,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":234.31},{"value":"20 regular 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":292,"W":848,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":326.63},{"value":"20 medium 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":321,"W":848,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":333.92},{"value":"20 semibold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":350,"W":848,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":343.04},{"value":"20 bold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":379,"W":848,"H":27},"size":20,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":297.18},{"value":"24 regular 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":408,"W":848,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":392.31},{"value":"24 medium 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":441,"W":848,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":400.95},{"value":"24 semibold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":474,"W":848,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":411.79},{"value":"24 bold 😀 👍🏽 🇨🇳 ✅ ❤️ 🧑‍💻 🚀","bounds":{"X":16,"Y":507,"W":848,"H":31},"size":24,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":356.66}],"rectangles":null,"triangles":null,"hits":null},"text-latin":{"scene":"text-latin","platform":"","width":880,"height":880,"dark":false,"texts":[{"value":"11 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":16,"W":848,"H":18},"size":11,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":436.53},{"value":"11 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":36,"W":848,"H":18},"size":11,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":445.44},{"value":"11 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":56,"W":848,"H":18},"size":11,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":455.37},{"value":"11 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":76,"W":848,"H":18},"size":11,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":435.07},{"value":"12 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":96,"W":848,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":478.55},{"value":"12 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":117,"W":848,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":488.25},{"value":"12 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":138,"W":848,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":499.07},{"value":"12 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":159,"W":848,"H":19},"size":12,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":476.91},{"value":"13 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":180,"W":848,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":518.53},{"value":"13 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":202,"W":848,"H":20},"size":13,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":529.07},{"value":"13 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":224,"W":848,"H":20},"size":13,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":540.83},{"value":"13 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":246,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":516.85},{"value":"14 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":268,"W":848,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":558.8},{"value":"14 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":291,"W":848,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":570.16},{"value":"14 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":314,"W":848,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":582.83},{"value":"14 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":337,"W":848,"H":21},"size":14,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":557.02},{"value":"16 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":360,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":638.23},{"value":"16 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":385,"W":848,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":651.2},{"value":"16 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":410,"W":848,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":665.69},{"value":"16 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":435,"W":848,"H":23},"size":16,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":636.18},{"value":"18 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":460,"W":848,"H":25},"size":18,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":717.98},{"value":"18 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":487,"W":848,"H":25},"size":18,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":732.59},{"value":"18 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":514,"W":848,"H":25},"size":18,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":748.91},{"value":"18 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":541,"W":848,"H":25},"size":18,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":715.73},{"value":"20 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":568,"W":848,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":801.88},{"value":"20 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":597,"W":848,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":818.17},{"value":"20 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":626,"W":848,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":836.34},{"value":"20 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":655,"W":848,"H":27},"size":20,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":799.51},{"value":"24 regular Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":684,"W":848,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":16,"Y":684,"W":848,"H":31},"canvasWidth":962.61},{"value":"24 medium Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":717,"W":848,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":16,"Y":717,"W":848,"H":31},"canvasWidth":982.05},{"value":"24 semibold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":750,"W":848,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":16,"Y":750,"W":848,"H":31},"canvasWidth":1003.75},{"value":"24 bold Hamburgefonstiv 0123456789 The quick brown fox jumps over the lazy dog.","bounds":{"X":16,"Y":783,"W":848,"H":31},"size":24,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"clip":{"X":16,"Y":783,"W":848,"H":31},"canvasWidth":959.46}],"rectangles":null,"triangles":null,"hits":null},"text-mixed":{"scene":"text-mixed","platform":"","width":880,"height":560,"dark":false,"texts":[{"value":"12 regular Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":16,"W":848,"H":19},"size":12,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":354.32},{"value":"12 medium Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":37,"W":848,"H":19},"size":12,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":360.69},{"value":"12 semibold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":58,"W":848,"H":19},"size":12,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":368.14},{"value":"12 bold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":79,"W":848,"H":19},"size":12,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":342.64},{"value":"14 regular Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":100,"W":848,"H":21},"size":14,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":413.85},{"value":"14 medium Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":123,"W":848,"H":21},"size":14,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":421.34},{"value":"14 semibold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":146,"W":848,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":430.08},{"value":"14 bold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":169,"W":848,"H":21},"size":14,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":400.37},{"value":"16 regular Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":192,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":472.58},{"value":"16 medium Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":217,"W":848,"H":23},"size":16,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":481.13},{"value":"16 semibold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":242,"W":848,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":491.12},{"value":"16 bold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":267,"W":848,"H":23},"size":16,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":457.16},{"value":"20 regular Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":292,"W":848,"H":27},"size":20,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":594.82},{"value":"20 medium Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":321,"W":848,"H":27},"size":20,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":605.58},{"value":"20 semibold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":350,"W":848,"H":27},"size":20,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":618.13},{"value":"20 bold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":379,"W":848,"H":27},"size":20,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":575.73},{"value":"24 regular Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":408,"W":848,"H":31},"size":24,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":714.14},{"value":"24 medium Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":441,"W":848,"H":31},"size":24,"weight":0.15,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":726.94},{"value":"24 semibold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":474,"W":848,"H":31},"size":24,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":741.89},{"value":"24 bold Motty 连接 host-01 ✅ 已连接 — 3 sessions · ß é ñ ø Ж","bounds":{"X":16,"Y":507,"W":848,"H":31},"size":24,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":690.93}],"rectangles":null,"triangles":null,"hits":null},"text-mono":{"scene":"text-mono","platform":"","width":640,"height":360,"dark":false,"texts":[{"value":"mono system","bounds":{"X":16,"Y":16,"W":608,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":87.54},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":41,"W":608,"H":13},"size":11,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":58,"W":608,"H":15},"size":12,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":77,"W":608,"H":16},"size":13,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":97,"W":608,"H":17},"size":14,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":118,"W":608,"H":19},"size":16,"weight":0,"mono":true,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"mono classic","bounds":{"X":16,"Y":141,"W":608,"H":21},"size":14,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":85.25},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":166,"W":608,"H":13},"size":11,"weight":0,"mono":true,"monoFace":1,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":183,"W":608,"H":15},"size":12,"weight":0,"mono":true,"monoFace":1,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":202,"W":608,"H":16},"size":13,"weight":0,"mono":true,"monoFace":1,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":222,"W":608,"H":17},"size":14,"weight":0,"mono":true,"monoFace":1,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0},{"value":"ls -la ~/.ssh | grep id_ 0Oo1lI |{}[] 界面 ✅","bounds":{"X":16,"Y":243,"W":608,"H":19},"size":16,"weight":0,"mono":true,"monoFace":1,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":0}],"rectangles":null,"triangles":null,"hits":null},"text-scripts":{"scene":"text-scripts","platform":"","width":880,"height":900,"dark":false,"texts":[{"value":"Arabic","bounds":{"X":16,"Y":16,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":32.24},{"value":"السلام عليكم ورحمة الله وبركاته. هذه تجربة لعرض النص العربي","bounds":{"X":444.94,"Y":37,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":419.06},{"value":"السلام عليكم ورحمة الله وبركاته. هذه تجربة لعرض النص العربي","bounds":{"X":516.31,"Y":63,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":347.69},{"value":"Persian","bounds":{"X":16,"Y":86,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":37.18},{"value":"سلام دنیا! این یک متن آزمایشی فارسی است","bounds":{"X":566.16,"Y":107,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":297.84},{"value":"سلام دنیا! این یک متن آزمایشی فارسی است","bounds":{"X":617.13,"Y":133,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":246.87},{"value":"Hebrew","bounds":{"X":16,"Y":156,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":39.24},{"value":"שלום עולם! זוהי דוגמה להצגת טקסט בעברית בממשק המשתמש","bounds":{"X":436.62,"Y":177,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":427.38},{"value":"שלום עולם! זוהי דוגמה להצגת טקסט בעברית בממשק המשתמש","bounds":{"X":508.55,"Y":203,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":355.45},{"value":"Thai","bounds":{"X":16,"Y":226,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":21.55},{"value":"สวัสดีครับ นี่คือตัวอย่างข้อความภาษาไทยในอินเทอร์เฟซผู้ใช้","bounds":{"X":16,"Y":247,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":366.8},{"value":"สวัสดีครับ นี่คือตัวอย่างข้อความภาษาไทยในอินเทอร์เฟซผู้ใช้","bounds":{"X":16,"Y":273,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":308.68},{"value":"Hindi","bounds":{"X":16,"Y":296,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":25.67},{"value":"नमस्ते दुनिया! यह यूज़र इंटरफ़ेस में हिन्दी पाठ दिखाने का उदाहरण है","bounds":{"X":16,"Y":317,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":422.54},{"value":"नमस्ते दुनिया! यह यूज़र इंटरफ़ेस में हिन्दी पाठ दिखाने का उदाहरण है","bounds":{"X":16,"Y":343,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":349.28},{"value":"Bengali","bounds":{"X":16,"Y":366,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":36.82},{"value":"ওহে বিশ্ব! এটি ব্যবহারকারী ইন্টারফেসে বাংলা লেখা দেখানোর একটি উদাহরণ","bounds":{"X":16,"Y":387,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":545.52},{"value":"ওহে বিশ্ব! এটি ব্যবহারকারী ইন্টারফেসে বাংলা লেখা দেখানোর একটি উদাহরণ","bounds":{"X":16,"Y":413,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":454.4},{"value":"Tamil","bounds":{"X":16,"Y":436,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":27.11},{"value":"வணக்கம் உலகம்! இது பயனர் இடைமுகத்தில் தமிழ் உரையைக் காட்டும் எடுத்துக்காட்டு","bounds":{"X":16,"Y":457,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":783.44},{"value":"வணக்கம் உலகம்! இது பயனர் இடைமுகத்தில் தமிழ் உரையைக் காட்டும் எடுத்துக்காட்டு","bounds":{"X":16,"Y":483,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":655.77},{"value":"Telugu","bounds":{"X":16,"Y":506,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":34.5},{"value":"నమస్కారం ప్రపంచం! ఇది తెలుగు పాఠ్యానికి ఒక ఉదాహరణ","bounds":{"X":16,"Y":527,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":446.02},{"value":"నమస్కారం ప్రపంచం! ఇది తెలుగు పాఠ్యానికి ఒక ఉదాహరణ","bounds":{"X":16,"Y":553,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":372.55},{"value":"Korean","bounds":{"X":16,"Y":576,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":35.73},{"value":"안녕하세요 세계! 사용자 인터페이스에서 한국어 텍스트를 표시하는 예제입니다","bounds":{"X":16,"Y":597,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":562.66},{"value":"안녕하세요 세계! 사용자 인터페이스에서 한국어 텍스트를 표시하는 예제입니다","bounds":{"X":16,"Y":623,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":453.92},{"value":"Khmer","bounds":{"X":16,"Y":646,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":32.72},{"value":"សួស្តី​ពិភពលោក ភាសាខ្មែរ ជាឧទាហរណ៍","bounds":{"X":16,"Y":667,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":273.59},{"value":"សួស្តី​ពិភពលោក ភាសាខ្មែរ ជាឧទាហរណ៍","bounds":{"X":16,"Y":693,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":229.38},{"value":"Myanmar","bounds":{"X":16,"Y":716,"W":848,"H":18},"size":11,"weight":0,"color":[0.4509804,0.4509804,0.4509804,1],"canvasWidth":46.8},{"value":"မင်္ဂလာပါ ကမ္ဘာ မြန်မာဘာသာ စာသား နမူနာ","bounds":{"X":16,"Y":737,"W":848,"H":23},"size":16,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":284.23},{"value":"မင်္ဂလာပါ ကမ္ဘာ မြန်မာဘာသာ စာသား နမူနာ","bounds":{"X":16,"Y":763,"W":848,"H":20},"size":13,"weight":0.4,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":236.97}],"rectangles":null,"triangles":null,"hits":null},"text-wrap":{"scene":"text-wrap","platform":"","width":960,"height":560,"dark":false,"texts":[{"value":"Viva lays text out in","bounds":{"X":25,"Y":25,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":114.92},{"value":"lines: a paragraph","bounds":{"X":25,"Y":45,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":105.64},{"value":"breaks at spaces,","bounds":{"X":25,"Y":65,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":103.99},{"value":"between East Asian","bounds":{"X":25,"Y":85,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":115.94},{"value":"characters, after the","bounds":{"X":25,"Y":105,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":120.03},{"value":"separators of a long","bounds":{"X":25,"Y":125,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":118.25},{"value":"path such as /usr/local/","bounds":{"X":25,"Y":145,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":138.54},{"value":"share/applications/","bounds":{"X":25,"Y":165,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":112.96},{"value":"example.desktop, and","bounds":{"X":25,"Y":185,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130.25},{"value":"as a last resort inside a","bounds":{"X":25,"Y":205,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":135.61},{"value":"word like","bounds":{"X":25,"Y":225,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":53.71},{"value":"pneumonoultramicros…","bounds":{"X":25,"Y":245,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":139.78},{"value":"文本按宽度折行:东亚","bounds":{"X":25,"Y":277,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130},{"value":"文字可以在任意两个字","bounds":{"X":25,"Y":297,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130},{"value":"符之间断开,但是句","bounds":{"X":25,"Y":317,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":117},{"value":"号、逗号等标点不会出","bounds":{"X":25,"Y":337,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130},{"value":"现在行首。日本語の文","bounds":{"X":25,"Y":357,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130},{"value":"章も同じように折り返","bounds":{"X":25,"Y":377,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130},{"value":"されます。","bounds":{"X":25,"Y":397,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":65},{"value":"Viva lays text out","bounds":{"X":25,"Y":429,"W":142,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":127.8},{"value":"in lines: a","bounds":{"X":25,"Y":452,"W":142,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":69.84},{"value":"paragraph break…","bounds":{"X":25,"Y":475,"W":142,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":137.72},{"value":"Viva lays text out in lines: a","bounds":{"X":201,"Y":25,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":159.82},{"value":"paragraph breaks at spaces,","bounds":{"X":201,"Y":45,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":168.24},{"value":"between East Asian characters, after","bounds":{"X":201,"Y":65,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":217.23},{"value":"the separators of a long path such","bounds":{"X":201,"Y":85,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":202.12},{"value":"as /usr/local/share/applications/","bounds":{"X":201,"Y":105,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":189.88},{"value":"example.desktop, and as a last resort","bounds":{"X":201,"Y":125,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":220.42},{"value":"inside a word like","bounds":{"X":201,"Y":145,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":102.67},{"value":"pneumonoultramicroscopicsilicovolc","bounds":{"X":201,"Y":165,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":216.31},{"value":"anoconiosis.","bounds":{"X":201,"Y":185,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":74.15},{"value":"文本按宽度折行:东亚文字可以在任意","bounds":{"X":201,"Y":217,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":221},{"value":"两个字符之间断开,但是句号、逗号等","bounds":{"X":201,"Y":237,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":221},{"value":"标点不会出现在行首。日本語の文章も","bounds":{"X":201,"Y":257,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":221},{"value":"同じように折り返されます。","bounds":{"X":201,"Y":277,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":169},{"value":"Viva lays text out in lines: a","bounds":{"X":201,"Y":309,"W":222,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":201.51},{"value":"paragraph breaks at spaces,","bounds":{"X":201,"Y":332,"W":222,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":211.66},{"value":"between East Asian charact…","bounds":{"X":201,"Y":355,"W":222,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":221.13},{"value":"Viva lays text out in lines: a paragraph breaks at spaces,","bounds":{"X":457,"Y":25,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":331.58},{"value":"between East Asian characters, after the separators of a","bounds":{"X":457,"Y":45,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":332.19},{"value":"long path such as /usr/local/share/applications/","bounds":{"X":457,"Y":65,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":280.55},{"value":"example.desktop, and as a last resort inside a word like","bounds":{"X":457,"Y":85,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":326.59},{"value":"pneumonoultramicroscopicsilicovolcanoconiosis.","bounds":{"X":457,"Y":105,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":290.46},{"value":"文本按宽度折行:东亚文字可以在任意两个字符之间断开,","bounds":{"X":457,"Y":137,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":338},{"value":"但是句号、逗号等标点不会出现在行首。日本語の文章も同","bounds":{"X":457,"Y":157,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":338},{"value":"じように折り返されます。","bounds":{"X":457,"Y":177,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":156},{"value":"Viva lays text out in lines: a paragraph breaks","bounds":{"X":457,"Y":209,"W":342,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":336.84},{"value":"at spaces, between East Asian characters,","bounds":{"X":457,"Y":232,"W":342,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":315.14},{"value":"after the separators of a long path such as /…","bounds":{"X":457,"Y":255,"W":342,"H":23},"size":16,"weight":0.23,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":337.98}],"rectangles":null,"triangles":[{"points":[[16,16],[176,16],[175,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[16,16],[175,17],[17,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,16],[176,507],[175,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,16],[175,506],[175,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,507],[16,507],[17,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,507],[17,506],[175,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[16,507],[16,16],[17,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[16,507],[17,17],[17,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,16],[432,16],[431,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,16],[431,17],[193,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,16],[432,507],[431,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,16],[431,506],[431,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,507],[192,507],[193,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,507],[193,506],[431,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,507],[192,16],[193,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,507],[193,17],[193,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,16],[808,16],[807,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,16],[807,17],[449,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,16],[808,507],[807,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,16],[807,506],[807,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,507],[448,507],[449,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,507],[449,506],[807,506]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,507],[448,16],[449,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,507],[449,17],[449,506]],"color":[0.8980392,0.8980392,0.8980392,1]}],"hits":null},"text-wrap-scripts":{"scene":"text-wrap-scripts","platform":"","width":960,"height":720,"dark":false,"texts":[{"value":"هذه فقرة طويلة من","bounds":{"X":57.17,"Y":25,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":109.83},{"value":"النص العربي تُعرض في","bounds":{"X":38.73,"Y":45,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":128.27},{"value":"عمود ضيق لاختبار","bounds":{"X":64.71,"Y":65,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":102.29},{"value":"الالتفاف الأسطري واتجاه","bounds":{"X":34.56,"Y":85,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":132.44},{"value":"الكتابة من اليمين إلى","bounds":{"X":47.37,"Y":105,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":119.63},{"value":"اليسار في واجهة","bounds":{"X":76.7,"Y":125,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":90.3},{"value":"المستخدم.","bounds":{"X":109.98,"Y":145,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":57.02},{"value":"זוהי פסקה ארוכה של","bounds":{"X":53.76,"Y":175,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":113.24},{"value":"טקסט בעברית המוצגת","bounds":{"X":43.24,"Y":195,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":123.76},{"value":"בעמודה צרה כדי לבדוק","bounds":{"X":40.56,"Y":215,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":126.44},{"value":"את שבירת השורות ואת","bounds":{"X":40.69,"Y":235,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":126.31},{"value":"כיוון הכתיבה מימין","bounds":{"X":65.07,"Y":255,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":101.93},{"value":"לשמאל בממשק","bounds":{"X":81.4,"Y":275,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":85.6},{"value":"המשתמש.","bounds":{"X":110.21,"Y":295,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":56.79},{"value":"ประเทศไทยมีภาษาไทย","bounds":{"X":25,"Y":325,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":111.27},{"value":"เป็นภาษาราชการ ข้อความนี้","bounds":{"X":25,"Y":345,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":136.93},{"value":"ไม่มีช่องว่างระหว่างคำจึงต้","bounds":{"X":25,"Y":365,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":131.29},{"value":"องตัดบรรทัดตามพยางค์เพื่","bounds":{"X":25,"Y":385,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":137.2},{"value":"อให้พอดีกับความกว้า","bounds":{"X":25,"Y":405,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":105.07},{"value":"งของคอลัมน์","bounds":{"X":25,"Y":425,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":66.69},{"value":"यह हिन्दी भाषा में एक लंबा","bounds":{"X":25,"Y":455,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":136.25},{"value":"अनुच्छेद है जो संकरे स्तंभ में","bounds":{"X":25,"Y":475,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":141.54},{"value":"पंक्ति विभाजन और","bounds":{"X":25,"Y":495,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":100.36},{"value":"संयुक्ताक्षरों की जाँच के","bounds":{"X":25,"Y":515,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":118.28},{"value":"लिए दिखाया गया है।","bounds":{"X":25,"Y":535,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":104.46},{"value":"한국어 문단은 단어","bounds":{"X":25,"Y":565,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":111.02},{"value":"사이의 공백에서","bounds":{"X":25,"Y":585,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":94.51},{"value":"줄바꿈이 됩니다. 아주","bounds":{"X":25,"Y":605,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":127.61},{"value":"긴 단어는 폭에 맞지","bounds":{"X":25,"Y":625,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":114.53},{"value":"않으면 음절 사이에서","bounds":{"X":25,"Y":645,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":124.02},{"value":"나뉩니다","bounds":{"X":25,"Y":665,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":52},{"value":"대한민국만세대한민국","bounds":{"X":25,"Y":685,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":130},{"value":"만세.","bounds":{"X":25,"Y":705,"W":142,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":29.59},{"value":"هذه فقرة طويلة من النص العربي تُعرض","bounds":{"X":201.21,"Y":25,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":221.79},{"value":"في عمود ضيق لاختبار الالتفاف الأسطري","bounds":{"X":203.38,"Y":45,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":219.62},{"value":"واتجاه الكتابة من اليمين إلى اليسار في","bounds":{"X":204.18,"Y":65,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":218.82},{"value":"واجهة المستخدم.","bounds":{"X":332.91,"Y":85,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":90.09},{"value":"זוהי פסקה ארוכה של טקסט בעברית","bounds":{"X":227.64,"Y":115,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":195.36},{"value":"המוצגת בעמודה צרה כדי לבדוק את","bounds":{"X":230.78,"Y":135,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":192.22},{"value":"שבירת השורות ואת כיוון הכתיבה מימין","bounds":{"X":211.88,"Y":155,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":211.12},{"value":"לשמאל בממשק המשתמש.","bounds":{"X":277.09,"Y":175,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":145.91},{"value":"ประเทศไทยมีภาษาไทยเป็นภาษาราชการ ข้","bounds":{"X":201,"Y":205,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":205.55},{"value":"อความนี้ไม่มีช่องว่างระหว่างคำจึงต้","bounds":{"X":201,"Y":225,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":173.94},{"value":"องตัดบรรทัดตามพยางค์เพื่อให้พอดีกับควา","bounds":{"X":201,"Y":245,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":215.08},{"value":"มกว้างของคอลัมน์","bounds":{"X":201,"Y":265,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":93.88},{"value":"यह हिन्दी भाषा में एक लंबा अनुच्छेद है जो","bounds":{"X":201,"Y":295,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":211.42},{"value":"संकरे स्तंभ में पंक्ति विभाजन और","bounds":{"X":201,"Y":315,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":170.24},{"value":"संयुक्ताक्षरों की जाँच के लिए दिखाया गया","bounds":{"X":201,"Y":335,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":209.61},{"value":"है।","bounds":{"X":201,"Y":355,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":13.13},{"value":"한국어 문단은 단어 사이의 공백에서","bounds":{"X":201,"Y":385,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":209.04},{"value":"줄바꿈이 됩니다. 아주 긴 단어는 폭에","bounds":{"X":201,"Y":405,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":216.14},{"value":"맞지 않으면 음절 사이에서 나뉩니다","bounds":{"X":201,"Y":425,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":209.04},{"value":"대한민국만세대한민국만세.","bounds":{"X":201,"Y":445,"W":222,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":159.59},{"value":"هذه فقرة طويلة من النص العربي تُعرض في عمود ضيق","bounds":{"X":489.51,"Y":25,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":309.49},{"value":"لاختبار الالتفاف الأسطري واتجاه الكتابة من اليمين إلى اليسار","bounds":{"X":464.58,"Y":45,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":334.42},{"value":"في واجهة المستخدم.","bounds":{"X":689.08,"Y":65,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":109.92},{"value":"זוהי פסקה ארוכה של טקסט בעברית המוצגת בעמודה צרה כדי","bounds":{"X":465.38,"Y":95,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":333.62},{"value":"לבדוק את שבירת השורות ואת כיוון הכתיבה מימין לשמאל","bounds":{"X":487.05,"Y":115,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":311.95},{"value":"בממשק המשתמש.","bounds":{"X":696.46,"Y":135,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":102.54},{"value":"ประเทศไทยมีภาษาไทยเป็นภาษาราชการ ข้อความนี้ไม่มีช่องว่างระหว่า","bounds":{"X":457,"Y":165,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":337.5},{"value":"งคำจึงต้องตัดบรรทัดตามพยางค์เพื่อให้พอดีกับความกว้า","bounds":{"X":457,"Y":185,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":284.26},{"value":"งของคอลัมน์","bounds":{"X":457,"Y":205,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":66.69},{"value":"यह हिन्दी भाषा में एक लंबा अनुच्छेद है जो संकरे स्तंभ में पंक्ति","bounds":{"X":457,"Y":235,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":313.12},{"value":"विभाजन और संयुक्ताक्षरों की जाँच के लिए दिखाया गया है।","bounds":{"X":457,"Y":255,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":298.3},{"value":"한국어 문단은 단어 사이의 공백에서 줄바꿈이 됩니다. 아주","bounds":{"X":457,"Y":285,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":340.16},{"value":"긴 단어는 폭에 맞지 않으면 음절 사이에서 나뉩니다","bounds":{"X":457,"Y":305,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":297.57},{"value":"대한민국만세대한민국만세.","bounds":{"X":457,"Y":325,"W":342,"H":20},"size":13,"weight":0,"color":[0.039215688,0.039215688,0.039215688,1],"canvasWidth":159.59}],"rectangles":null,"triangles":[{"points":[[16,16],[176,16],[175,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[16,16],[175,17],[17,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,16],[176,734],[175,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,16],[175,733],[175,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,734],[16,734],[17,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[176,734],[17,733],[175,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[16,734],[16,16],[17,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[16,734],[17,17],[17,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,16],[432,16],[431,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,16],[431,17],[193,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,16],[432,734],[431,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,16],[431,733],[431,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,734],[192,734],[193,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[432,734],[193,733],[431,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,734],[192,16],[193,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[192,734],[193,17],[193,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,16],[808,16],[807,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,16],[807,17],[449,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,16],[808,734],[807,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,16],[807,733],[807,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,734],[448,734],[449,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[808,734],[449,733],[807,733]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,734],[448,16],[449,17]],"color":[0.8980392,0.8980392,0.8980392,1]},{"points":[[448,734],[449,17],[449,733]],"color":[0.8980392,0.8980392,0.8980392,1]}],"hits":null}} \ No newline at end of file diff --git a/ui/dialog_footer_test.go b/ui/dialog_footer_test.go new file mode 100644 index 000000000..a4490084a --- /dev/null +++ b/ui/dialog_footer_test.go @@ -0,0 +1,80 @@ +package ui_test + +import ( + "testing" + + "github.com/vivaui/viva/gfx" + "github.com/vivaui/viva/style" + "github.com/vivaui/viva/ui" +) + +func TestDialogFooterArrowsKeepIndividualTabStops(t *testing.T) { + var presses int + d := openPage(t, func(c ui.C) { + dialog := ui.Dialog(c, ui.DialogSpec{Title: "Review", Scope: gfx.Item(900), NoClose: true}) + dialog.Body(func() { ui.Button(c, "Details") }) + dialog.Footer(func() { + ui.Button(c, "Cancel") + ui.Button(c, "Unavailable").Disabled(true) + if ui.Button(c, "Accept").Clicked() { + presses++ + } + }) + }) + for _, step := range []struct { + key gfx.Key + mods gfx.Modifiers + want string + }{ + {gfx.KeyRight, 0, "Details"}, + {gfx.KeyTab, 0, "Cancel"}, + {gfx.KeyTab, 0, "Accept"}, + {gfx.KeyTab, gfx.ModifierShift, "Cancel"}, + {gfx.KeyLeft, 0, "Accept"}, + {gfx.KeyRight, 0, "Cancel"}, + {gfx.KeyEnd, 0, "Accept"}, + {gfx.KeyHome, 0, "Cancel"}, + {gfx.KeyRight, gfx.ModifierControl, "Cancel"}, + {gfx.KeyRight, 0, "Accept"}, + } { + if err := d.driver.Key(step.key, step.mods); err != nil { + t.Fatal(err) + } + if got := d.Focused(); got != step.want { + t.Fatalf("after key %v modifiers %v: focused %q, want %q", step.key, step.mods, got, step.want) + } + } + if presses != 0 { + t.Fatalf("moving focus activated Accept %d times", presses) + } + d.key(gfx.KeyEnter) + if presses != 1 { + t.Fatalf("Enter activated Accept %d times", presses) + } +} + +// A footer button is never narrower than style.DialogButtonMinWidth, whether the +// page put it in the footer directly or inside a row of its own, and a button the +// page gave a width keeps it. +func TestDialogFooterButtonsKeepAMinimumWidth(t *testing.T) { + var direct, nested, wide ui.Box + d := openPage(t, func(c ui.C) { + dialog := ui.Dialog(c, ui.DialogSpec{Title: "Review", Scope: gfx.Item(900), NoClose: true}) + dialog.Footer(func() { + direct = ui.Button(c, "OK") + ui.Row(c).Children(func() { + nested = ui.Button(c, "No") + wide = ui.Button(c, "Go").Width(40) + }) + }) + }) + d.repaint() + for name, box := range map[string]ui.Box{"direct": direct, "nested": nested} { + if got := box.Rect().Width; got < style.DialogButtonMinWidth { + t.Errorf("%s footer button is %v wide, want at least %v", name, got, float32(style.DialogButtonMinWidth)) + } + } + if got := wide.Rect().Width; got != 40 { + t.Errorf("a footer button with its own width is %v wide, want 40", got) + } +} diff --git a/ui/disclosure.go b/ui/disclosure.go index 20511ff47..acd4acc62 100644 --- a/ui/disclosure.go +++ b/ui/disclosure.go @@ -115,7 +115,7 @@ func disclosureHeader(c C, open *bool, title string, disabled bool) Box { if !disabled { header = header. Hover(Look{}.Background(theme.Hover)). - Focus(Look{}.Ring(3, fadedRing(theme))) + Focus(Look{}.Ring(theme.Metrics.FocusRing(), fadedRing(theme))) } header.Children(func() { base.Text(c, title). diff --git a/ui/hooks_install.go b/ui/hooks_install.go index 6836d6b4d..b718cf3ff 100644 --- a/ui/hooks_install.go +++ b/ui/hooks_install.go @@ -157,6 +157,7 @@ func useTable() { }) } func useTree() { + useScroll() // a Tree is a scroll area: Scrollbars draws its bars, as for a List installTree.Do(func() { base.PaintTreeRow = treeStateRow; base.TreeDraw = treeStateDraw }) } func useMenu() { diff --git a/ui/layers.go b/ui/layers.go index 98d8c85c1..2efe011cf 100644 --- a/ui/layers.go +++ b/ui/layers.go @@ -11,7 +11,3 @@ const ( LayerPaneChrome = base.LayerPaneChrome LayerDrag = base.LayerDrag ) - -// widgetLayerBase is the first layer Viva's own widgets paint on at the top of -// a page, from package base. -const widgetLayerBase = base.WidgetLayerBase diff --git a/ui/list_selection_test.go b/ui/list_selection_test.go index f6d924e55..babc1fc5e 100644 --- a/ui/list_selection_test.go +++ b/ui/list_selection_test.go @@ -164,6 +164,16 @@ func TestEmbeddedListReadsTheClicksModifiers(t *testing.T) { if m.submitted != 1 { t.Fatalf("double click in an embedded page submitted %d", m.submitted) } + // The third press of a sequence is a new single click: it chooses the row + // without submitting it, and the fourth completes the next double click. + click("delta", gfx.ClickInfo{Clicks: 3}) + if m.submitted != 1 || m.list.Selected() != 3 { + t.Fatalf("triple click: submitted row %d, selected %d, want it chosen without a submit", m.submitted, m.list.Selected()) + } + click("delta", gfx.ClickInfo{Clicks: 4}) + if m.submitted != 3 { + t.Fatalf("fourth press submitted row %d, want 3", m.submitted) + } } // The arrows move the focus and the choice, Shift extends from the anchor, and diff --git a/ui/popover_paint.go b/ui/popover_paint.go index 265c57c04..38f42b6b8 100644 --- a/ui/popover_paint.go +++ b/ui/popover_paint.go @@ -62,11 +62,15 @@ func framePopover(f *Frame, Anchor Box, spec PopoverSpec) Box { margin = 8 } b.Within(f.GetBounds().Inset(gfx.All(margin))) + // The panel's layer is decided here, as a Dialog's is: its header and body are + // declared on it, so a Select, Combobox or Menu in the panel opens above the + // panel instead of under it. + layer := max(f.WidgetLayer(), f.GetPopupLayer()) + 2 n := b.N() n.Flags |= FlagPopover f.SetPaintPopoverFn(paintPopover) n.Aux = int32(len(base.WidgetsOf(f).GetPopovers())) - base.WidgetsOf(f).SetPopovers(append(base.WidgetsOf(f).GetPopovers(), base.NewPopoverDecl(spec, Anchor.GetI(), base.WidgetsOf(f).GetLayer()))) + base.WidgetsOf(f).SetPopovers(append(base.WidgetsOf(f).GetPopovers(), base.NewPopoverDecl(spec, Anchor.GetI(), layer))) return b } @@ -76,7 +80,7 @@ func paintPopover(f *Frame, i int32, n *Node) { d := &base.WidgetsOf(f).GetPopovers()[n.Aux] spec := d.SpecPtr() canvas := f.Surface - layer := max(d.GetLayer(), f.GetPopupLayer(), widgetLayerBase) + 2 + layer := d.GetLayer() canvas.PushLayer(layer) canvas.PushFocusScope(spec.Scope) canvas.ReturnFocus(spec.Scope) diff --git a/ui/popover_test.go b/ui/popover_test.go index 5ee89838e..eb5ee07f2 100644 --- a/ui/popover_test.go +++ b/ui/popover_test.go @@ -185,3 +185,40 @@ func TestPopoverInstantKeepsTheLayout(t *testing.T) { t.Fatalf("instant body %+v, animated %+v", instant, animated) } } + +// A Select in a Popover opens above the panel, not under it: the panel declares +// its body on its own layer, so the list takes the layer above, as a Select in a +// Dialog does. The panel at the same layer as its body would otherwise paint over +// the list. +func TestPopoverBodySelectOpensAbovePanel(t *testing.T) { + open := true + size := "S" + d := openPage(t, func(c ui.C) { + more := ui.Button(c, "More") + ui.Popover(c, more, &open, ui.PopoverSpec{Width: 240, Title: "Panel"}, func() { + ui.Select(c, &size, []string{"S", "M", "L"}, nil).Placeholder("Size") + }) + }) + d.click("Size") + panelLayer := uint16(0) + for _, text := range d.driver.Snapshot().Texts { + if text.Value == "Panel" { + panelLayer = max(panelLayer, text.Layer) + } + } + if panelLayer == 0 { + t.Fatal("the popover title was not painted") + } + option, found := gfx.Hit{}, false + for _, hit := range d.driver.Snapshot().Hits { + if hit.Role == gfx.RoleOption && hit.Label == "M" && !hit.IsLabel { + option, found = hit, true + } + } + if !found { + t.Fatal("the open select shows no option hit") + } + if option.Layer <= panelLayer { + t.Fatalf("the option is on layer %d, not above the panel on %d", option.Layer, panelLayer) + } +} diff --git a/ui/tooltip_disabled_test.go b/ui/tooltip_disabled_test.go new file mode 100644 index 000000000..63e32a921 --- /dev/null +++ b/ui/tooltip_disabled_test.go @@ -0,0 +1,35 @@ +package ui_test + +import ( + "testing" + "time" + + "github.com/vivaui/viva/ui" +) + +// A disabled control cannot be pressed, but it is the one the pointer rests on, +// so its Tooltip still says what it is: an icon alone does not, and the user +// cannot tell what the greyed control would do. +func TestTooltipShowsOnADisabledControl(t *testing.T) { + clicks := 0 + d := openPage(t, func(c ui.C) { + ui.Column(c).Pad(40).Gap(20).Children(func() { + if ui.Button(c, "Export").Tooltip("Export recording").Disabled(true).Clicked() { + clicks++ + } + ui.Button(c, "Save").Tooltip("Save output") + }) + }) + d.rest("Export", 2*time.Second) + if got := textTooltip(d); got != "Export recording" { + t.Fatalf("tooltip over the disabled control = %q", got) + } + d.click("Export") + if clicks != 0 { + t.Fatalf("a disabled control took %d clicks", clicks) + } + d.rest("Save", 2*time.Second) + if got := textTooltip(d); got != "Save output" { + t.Fatalf("tooltip over the enabled control = %q", got) + } +} diff --git a/ui/tooltip_paint.go b/ui/tooltip_paint.go index 0756cfaf5..9609d228a 100644 --- a/ui/tooltip_paint.go +++ b/ui/tooltip_paint.go @@ -49,6 +49,10 @@ func paintTooltip(f *Frame) { // The element a tooltip belongs to: the one the pointer rests on, or the one a finger // held (the press that opens it, then the element it stays for). target := f.Surface.Hovered() + if disabled := f.Surface.HoveredDisabled(); f.HasTooltip(disabled) { + // A disabled control is never hovered, but it is the one in front of the pointer. + target = disabled + } if event, _, ok := f.Surface.PointerPass(); ok && event.Device == gfx.PointerTouch && event.Kind == gfx.PointerDown && event.Button == gfx.PointerButtonSecondary { target = event.Target diff --git a/ui/tree_scrollbar_test.go b/ui/tree_scrollbar_test.go new file mode 100644 index 000000000..b0ff8b6c7 --- /dev/null +++ b/ui/tree_scrollbar_test.go @@ -0,0 +1,37 @@ +package ui_test + +import ( + "fmt" + "os" + "os/exec" + "testing" + + "github.com/vivaui/viva/ui" +) + +// A Tree is a scroll area, and Scrollbars draws its bars. A page whose first +// scroll area is a Tree has no scrollbar painter unless the Tree installs it, and +// then a list longer than its room is cut off with no bar to reach the rest. +// +// The painters install once per process, so this runs in a child process: by the +// time it would run in this one, the other tests here have already installed the +// painter through a List or a Scroll, and the Tree's omission would not show. +func TestATreePaintsItsOwnScrollbars(t *testing.T) { + if os.Getenv("VIVA_TREE_SCROLLBAR_CHILD") == "" { + cmd := exec.Command(os.Args[0], "-test.run=^TestATreePaintsItsOwnScrollbars$") + cmd.Env = append(os.Environ(), "VIVA_TREE_SCROLLBAR_CHILD=1") + if out, err := cmd.CombinedOutput(); err != nil { + t.Fatalf("a page that only declares a Tree painted no scrollbar: %v\n%s", err, out) + } + return + } + var state ui.TreeState + state.Node = func(i int) ui.TreeNode { return ui.TreeNode{Height: 32} } + d := openPage(t, func(c ui.C) { + ui.Tree(c, &state, 10, func(i int) string { return fmt.Sprintf("row %d", i) }, nil). + Size(200, 96).AlwaysScrollbars() + }) + if !d.has("Vertical scrollbar") { + t.Fatal("the Tree painted no scrollbar over its clipped rows") + } +} diff --git a/website/content/guides/en/system-integration.md b/website/content/guides/en/system-integration.md index 27663fcdd..f503769d8 100644 --- a/website/content/guides/en/system-integration.md +++ b/website/content/guides/en/system-integration.md @@ -9,7 +9,7 @@ The `app` package exposes a small, synchronous set of system integrations. An op | Capability | Functions | | --- | --- | -| Clipboard text | `app.ClipboardText`, `app.SetClipboardText` | +| Clipboard text | `app.ClipboardText`, `app.SetClipboardText`, `app.SetSensitiveClipboardText` | | File dialogs | `app.OpenFiles`, `app.OpenDirectory`, `app.SaveFile` | | Open a URL | `app.OpenURL` | | Open a local document in its default application (never a program) | `app.OpenPath` | diff --git a/website/content/guides/en/windows.md b/website/content/guides/en/windows.md index 9f32e120c..671098a11 100644 --- a/website/content/guides/en/windows.md +++ b/website/content/guides/en/windows.md @@ -66,6 +66,25 @@ The headless application's `Window.SetFullscreen` queues work for the driver's next pump, without a worker or polling. Its command protocol also provides `fullscreen on|off` and `fullscreenmonitor x y width height`. +### Fullscreen across every monitor + +`window.Monitors()` lists the displays in device pixels of the virtual screen +(`app.Monitor`: position, size, `Scale`, `Primary`). The primary display is first +and sits at the origin; one left of or above it has a negative `X` or `Y`. +`window.SetFullscreenAllMonitors(true)` makes the window fullscreen over the box +around all of them, as a remote desktop that shows several displays as one +picture needs. A fullscreen window changes between one monitor and all of them +with `SetFullscreenAllMonitors(true)` and `SetFullscreen(true)` without leaving +fullscreen or repeating `OnFullscreen`; `SetFullscreenAllMonitors(false)` leaves it +like `SetFullscreen(false)`. A host that cannot span returns an error wrapping +`app.ErrUnsupported` and leaves the window as it was: a Wayland compositor places +windows itself, and macOS clips a window to one display while System Settings' +"Displays have separate Spaces" is on. + +For tests, `Driver.SetMonitors([]app.Monitor)` defines the displays and +`Driver.SetFullscreenAllMonitors(bool)` covers them; the headless command +protocol provides `monitors x y w h [x y w h ...]` and `fullscreen all`. + ## Changing the content size Call `window.SetSize(width, height)` to ask the window manager for a new content diff --git a/website/content/guides/zh/system-integration.md b/website/content/guides/zh/system-integration.md index f69432e8c..bb798b654 100644 --- a/website/content/guides/zh/system-integration.md +++ b/website/content/guides/zh/system-integration.md @@ -9,7 +9,7 @@ group: guides | 能力 | 函数 | | --- | --- | -| 剪贴板文本 | `app.ClipboardText`、`app.SetClipboardText` | +| 剪贴板文本 | `app.ClipboardText`、`app.SetClipboardText`、`app.SetSensitiveClipboardText` | | 文件对话框 | `app.OpenFiles`、`app.OpenDirectory`、`app.SaveFile` | | 打开 URL | `app.OpenURL` | | 用默认应用打开本地文档(绝不运行程序) | `app.OpenPath` | diff --git a/website/content/guides/zh/windows.md b/website/content/guides/zh/windows.md index 2ff240380..76ef75239 100644 --- a/website/content/guides/zh/windows.md +++ b/website/content/guides/zh/windows.md @@ -39,6 +39,12 @@ Windows 使用整个显示器而不是任务栏工作区,并保存之前的位 无头应用的 `Window.SetFullscreen` 把工作排进 driver 的下一次 pump,不需要 worker,也不轮询。它的命令协议还提供 `fullscreen on|off` 和 `fullscreenmonitor x y width height`。 +### 跨所有显示器全屏 + +`window.Monitors()` 以虚拟屏幕的设备像素列出所有显示器(`app.Monitor`:位置、大小、`Scale`、`Primary`)。主显示器排在第一位且位于原点;位于其左侧或上方的显示器 `X` 或 `Y` 为负。`window.SetFullscreenAllMonitors(true)` 让窗口全屏覆盖所有显示器的外接矩形,供把多个显示器当作一幅画面显示的远程桌面使用。全屏中的窗口用 `SetFullscreenAllMonitors(true)` 和 `SetFullscreen(true)` 在单个显示器与全部显示器之间切换,不会退出全屏,也不会再次触发 `OnFullscreen`;`SetFullscreenAllMonitors(false)` 与 `SetFullscreen(false)` 一样退出全屏。不能跨屏的宿主会返回包装了 `app.ErrUnsupported` 的错误,并保持窗口不变:Wayland 合成器自己决定窗口的位置,macOS 在“显示器具有单独的空间”开启时会把窗口裁剪到一个显示器内。 + +测试时,`Driver.SetMonitors([]app.Monitor)` 定义显示器,`Driver.SetFullscreenAllMonitors(bool)` 覆盖它们;无头命令协议提供 `monitors x y w h [x y w h ...]` 和 `fullscreen all`。 + ## 改变内容尺寸 调用 `window.SetSize(width, height)` 请求窗口管理器把内容区域改成给定的逻辑像素尺寸。调用是异步的,可以从任意 goroutine 发起;`Config.OnResize` 报告实际获得的尺寸,它可能被窗口最小尺寸、屏幕工作区或平台上限(宽高必须在 1 到 65535 之间)夹住。最大化、最小化或全屏的窗口会忽略这个请求。`OpenContentWindow` 返回的 `ContentWindow` 转发同一个调用,无头应用会在 driver 的下一次 pump 应用它。不支持该能力的宿主返回一个包装了 `app.ErrUnsupported` 的错误。