// Copyright (c) 2026 Storm Dragon // Authors: Storm Dragon, Angus Kola // SPDX-License-Identifier: GPL-3.0-or-later package app import ( "slices" "strings" "git.stormux.org/storm/cthulhu/internal/remote" ) func wineEchoEditField(event remote.AccessibleEvent) bool { return strings.EqualFold(event.Role, "edit") && event.Description != "password" && !slices.Contains(strings.Split(event.States, ", "), "read only") && !slices.Contains(strings.Split(event.States, ", "), "password") } // Raw key names need current desktop ownership as well as Wine's last control. // Text insertion feedback already passes the helper's focused-editor checks. func (owner *wineEventPresenter) EditFieldFocused() bool { owner.mu.Lock() defer owner.mu.Unlock() if owner.closed || !owner.editable || owner.protected || owner.focused == "" || owner.foreground == nil || owner.titles == nil { return false } foreground, title := owner.foreground.Foreground(), owner.titles.ForegroundTitle() return foreground.Client.Known && foreground.Client.Window != 0 && foreground.Epoch == owner.echoEpoch && title.Epoch == foreground.Epoch && title.Title.Window == foreground.Client.Window && title.Title.Wine && title.Title.Focused && equivalentWindowTitles(title.Title.Title, owner.echoTitle) }