// Code generated by internal/mobile/wire/gen from spec.go; DO NOT EDIT. package wire // Numbers of calls. const ( CallAppInfo = 1 CallTimeZone = 2 CallTheme = 3 CallSetAppearance = 4 CallScreen = 5 CallLog = 6 CallCreateWindow = 7 CallFirstFrame = 8 CallPlaceViews = 9 CallShowWindow = 10 CallHideWindow = 11 CallCloseWindow = 12 CallSetBackground = 13 CallFocus = 14 CallSetTitle = 15 CallCreateTabs = 16 CallAddTab = 17 CallShowTabs = 18 CallSelectTab = 19 CallSetTabBadge = 20 CallCloseTabs = 21 CallPushWindow = 22 CallPopWindow = 23 CallSetStack = 24 CallStackShown = 25 CallLoadURL = 26 CallLoadHTML = 27 CallReload = 28 CallStopLoading = 29 CallGoBack = 30 CallGoForward = 31 CallEval = 32 CallCallAsync = 33 CallSetZoom = 34 CallSetUserAgent = 35 CallSetUserScripts = 36 CallCapturePage = 37 CallUserAgent = 38 CallSchemeRespond = 39 CallSchemeData = 40 CallSchemeFinish = 41 CallSchemeFail = 42 CallMessageBox = 43 CallOpenFiles = 44 CallShareFile = 45 CallClipboardText = 46 CallSetClipboardText = 47 CallOpenURL = 48 CallSecretGet = 49 CallSecretSet = 50 CallSecretDelete = 51 CallNotify = 52 CallRemoveNotification = 53 CallRemoveAllNotifications = 54 CallKeepAwake = 55 CallNetworkStatus = 56 CallWatchNetwork = 57 CallBattery = 58 CallSetSystemBars = 59 CallSetOrientations = 60 CallShare = 61 CallSaveFile = 62 CallClipboardImage = 63 CallSetClipboardImage = 64 CallPopupMenu = 65 CallSetBarItems = 66 CallPluginCall = 67 CallAudioOpen = 68 CallAudioWrite = 69 CallAudioClose = 70 CallHaptic = 71 CallRequestFrame = 72 CallSetTextInput = 73 CallSetCursor = 74 CallAccessibilityChanged = 75 CallAnnounce = 76 CallShowMenu = 77 CallSetBackAvailable = 78 CallShowMagnifier = 79 CallHideMagnifier = 80 CallTextMetrics = 81 CallMeasureText = 82 CallTextAdvances = 83 CallDrawText = 84 CallRegisterFont = 85 ) // Numbers of events. const ( EventReady = 1 EventActive = 2 EventBackground = 3 EventThemeChanged = 4 EventLocaleChanged = 5 EventTimeZoneChanged = 6 EventOpenURLs = 7 EventMemoryWarning = 8 EventTerminating = 9 EventResized = 10 EventBackGesture = 11 EventStatusBarTapped = 12 EventViewPressed = 13 EventPluginResult = 14 EventPluginEvent = 15 EventNetworkChanged = 16 EventShareResult = 17 EventMenuPicked = 18 EventBarItemClicked = 19 EventTabSelected = 20 EventStackPopped = 21 EventPopped = 22 EventBackPressed = 23 EventMessage = 24 EventWillNavigate = 25 EventNewWindow = 26 EventPageState = 27 EventNavigationStarted = 28 EventNavigationCommitted = 29 EventLoadFinished = 30 EventLoadFailed = 31 EventClosedByPage = 32 EventWindowFront = 33 EventProcessGone = 34 EventPermissionRequested = 35 EventSchemeRequest = 36 EventSchemeCancel = 37 EventAsyncResult = 38 EventCaptured = 39 EventMessageBoxResult = 40 EventFilesResult = 41 EventNotifyDone = 42 EventNotificationClicked = 43 EventFrame = 44 EventSurfaceChanged = 45 EventSurfaceDestroyed = 46 EventTouch = 47 EventScroll = 48 EventKey = 49 EventTextReplace = 50 EventTextMark = 51 EventTextUnmark = 52 EventTextDelete = 53 EventTextSelect = 54 EventTextCommand = 55 EventTextState = 56 EventTextRange = 57 EventTextBounds = 58 EventTextIndexAt = 59 EventTextInputEnded = 60 EventAccessibilityTree = 61 EventAccessibilityAction = 62 ) // AppInfo is the app's bundle and the system's settings, asked once at start. type AppInfo struct { } func (m *AppInfo) Encode(w *Writer) { w.Uvarint(CallAppInfo) } // Wait reports whether the caller waits for the host to run it. func (*AppInfo) Wait() bool { return true } type AppInfoReply struct { Name string Version string Identifier string FilesDir string CacheDir string TempDir string DocumentsDir string ResourcesDir string Languages []string RegionLocale string FirstWeekday int HourCycle int System string SystemVersion string Model string Restoring bool Background bool } func (m *AppInfoReply) Decode(r *Reader) { m.Name = r.String() m.Version = r.String() m.Identifier = r.String() m.FilesDir = r.String() m.CacheDir = r.String() m.TempDir = r.String() m.DocumentsDir = r.String() m.ResourcesDir = r.String() m.Languages = r.Strings() m.RegionLocale = r.String() m.FirstWeekday = r.Int() m.HourCycle = r.Int() m.System = r.String() m.SystemVersion = r.String() m.Model = r.String() m.Restoring = r.Bool() m.Background = r.Bool() } // TimeZone is the name of the system's time zone; any thread. type TimeZone struct { } func (m *TimeZone) Encode(w *Writer) { w.Uvarint(CallTimeZone) } // Wait reports whether the caller waits for the host to run it. func (*TimeZone) Wait() bool { return true } type TimeZoneReply struct { ID string } func (m *TimeZoneReply) Decode(r *Reader) { m.ID = r.String() } // Theme is the appearance and the accessibility preferences. type Theme struct { } func (m *Theme) Encode(w *Writer) { w.Uvarint(CallTheme) } // Wait reports whether the caller waits for the host to run it. func (*Theme) Wait() bool { return true } type ThemeReply struct { Dark bool Accent int ReduceMotion bool ReduceTransparency bool IncreaseContrast bool TextScale float64 } func (m *ThemeReply) Decode(r *Reader) { m.Dark = r.Bool() m.Accent = r.Int() m.ReduceMotion = r.Bool() m.ReduceTransparency = r.Bool() m.IncreaseContrast = r.Bool() m.TextScale = r.Float() } // SetAppearance is the appearance the app asks for: "light", "dark" or "system". type SetAppearance struct { Source string } func (m *SetAppearance) Encode(w *Writer) { w.Uvarint(CallSetAppearance) w.String(m.Source) } // Wait reports whether the caller waits for the host to run it. func (*SetAppearance) Wait() bool { return false } // Screen is the screen's size in DIPs and scale. type Screen struct { } func (m *Screen) Encode(w *Writer) { w.Uvarint(CallScreen) } // Wait reports whether the caller waits for the host to run it. func (*Screen) Wait() bool { return true } type ScreenReply struct { Width float64 Height float64 Scale float64 } func (m *ScreenReply) Decode(r *Reader) { m.Width = r.Float() m.Height = r.Float() m.Scale = r.Float() } // Log is a line the app wrote to its standard output or error. type Log struct { Error bool Line string } func (m *Log) Encode(w *Writer) { w.Uvarint(CallLog) w.Bool(m.Error) w.String(m.Line) } // Wait reports whether the caller waits for the host to run it. func (*Log) Wait() bool { return false } // CreateWindow is the screen's content: a web view, or a surface for native UI. type CreateWindow struct { ID int Surface bool OwnScene bool Background int HasBackground bool Schemes []string Scripts []string ScriptFlags []string UserAgent string UserAgentSuffix string Inspectable bool Autoplay bool SwipeNavigation bool PinchZoom bool Parent int ViewType string ViewArgs string } func (m *CreateWindow) Encode(w *Writer) { w.Uvarint(CallCreateWindow) w.Int(m.ID) w.Bool(m.Surface) w.Bool(m.OwnScene) w.Int(m.Background) w.Bool(m.HasBackground) w.Strings(m.Schemes) w.Strings(m.Scripts) w.Strings(m.ScriptFlags) w.String(m.UserAgent) w.String(m.UserAgentSuffix) w.Bool(m.Inspectable) w.Bool(m.Autoplay) w.Bool(m.SwipeNavigation) w.Bool(m.PinchZoom) w.Int(m.Parent) w.String(m.ViewType) w.String(m.ViewArgs) } // Wait reports whether the caller waits for the host to run it. func (*CreateWindow) Wait() bool { return true } type CreateWindowReply struct { Error string Layer int } func (m *CreateWindowReply) Decode(r *Reader) { m.Error = r.String() m.Layer = r.Int() } // FirstFrame is the window's content presented its first frame. type FirstFrame struct { ID int } func (m *FirstFrame) Encode(w *Writer) { w.Uvarint(CallFirstFrame) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*FirstFrame) Wait() bool { return false } // PlaceViews is where a surface shows the windows it holds (Parent), under it, in the order painted; the others hide. Places: encoded by Go (encodePlaces). type PlaceViews struct { ID int Places []byte } func (m *PlaceViews) Encode(w *Writer) { w.Uvarint(CallPlaceViews) w.Int(m.ID) w.Bytes(m.Places) } // Wait reports whether the caller waits for the host to run it. func (*PlaceViews) Wait() bool { return false } type ShowWindow struct { ID int } func (m *ShowWindow) Encode(w *Writer) { w.Uvarint(CallShowWindow) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*ShowWindow) Wait() bool { return false } type HideWindow struct { ID int } func (m *HideWindow) Encode(w *Writer) { w.Uvarint(CallHideWindow) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*HideWindow) Wait() bool { return false } type CloseWindow struct { ID int } func (m *CloseWindow) Encode(w *Writer) { w.Uvarint(CallCloseWindow) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*CloseWindow) Wait() bool { return false } type SetBackground struct { ID int Color int } func (m *SetBackground) Encode(w *Writer) { w.Uvarint(CallSetBackground) w.Int(m.ID) w.Int(m.Color) } // Wait reports whether the caller waits for the host to run it. func (*SetBackground) Wait() bool { return false } type Focus struct { ID int } func (m *Focus) Encode(w *Writer) { w.Uvarint(CallFocus) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*Focus) Wait() bool { return false } // SetTitle is the window's title, which a navigation bar shows. type SetTitle struct { ID int Title string } func (m *SetTitle) Encode(w *Writer) { w.Uvarint(CallSetTitle) w.Int(m.ID) w.String(m.Title) } // Wait reports whether the caller waits for the host to run it. func (*SetTitle) Wait() bool { return false } // CreateTabs is a bar of tabs, whose tabs AddTab adds before ShowTabs shows it. type CreateTabs struct { ID int } func (m *CreateTabs) Encode(w *Writer) { w.Uvarint(CallCreateTabs) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*CreateTabs) Wait() bool { return false } type AddTab struct { ID int Window int Title string Symbol string Icon []byte } func (m *AddTab) Encode(w *Writer) { w.Uvarint(CallAddTab) w.Int(m.ID) w.Int(m.Window) w.String(m.Title) w.String(m.Symbol) w.Bytes(m.Icon) } // Wait reports whether the caller waits for the host to run it. func (*AddTab) Wait() bool { return false } type ShowTabs struct { ID int } func (m *ShowTabs) Encode(w *Writer) { w.Uvarint(CallShowTabs) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*ShowTabs) Wait() bool { return false } type SelectTab struct { ID int Index int } func (m *SelectTab) Encode(w *Writer) { w.Uvarint(CallSelectTab) w.Int(m.ID) w.Int(m.Index) } // Wait reports whether the caller waits for the host to run it. func (*SelectTab) Wait() bool { return false } type SetTabBadge struct { ID int Index int Badge string } func (m *SetTabBadge) Encode(w *Writer) { w.Uvarint(CallSetTabBadge) w.Int(m.ID) w.Int(m.Index) w.String(m.Badge) } // Wait reports whether the caller waits for the host to run it. func (*SetTabBadge) Wait() bool { return false } type CloseTabs struct { ID int } func (m *CloseTabs) Encode(w *Writer) { w.Uvarint(CallCloseTabs) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*CloseTabs) Wait() bool { return false } // PushWindow is shows Child over Parent in Parent's stack, under a bar with its Title and a back button. type PushWindow struct { Parent int Child int Title string Animated bool } func (m *PushWindow) Encode(w *Writer) { w.Uvarint(CallPushWindow) w.Int(m.Parent) w.Int(m.Child) w.String(m.Title) w.Bool(m.Animated) } // Wait reports whether the caller waits for the host to run it. func (*PushWindow) Wait() bool { return false } type PopWindow struct { ID int Animated bool } func (m *PopWindow) Encode(w *Writer) { w.Uvarint(CallPopWindow) w.Int(m.ID) w.Bool(m.Animated) } // Wait reports whether the caller waits for the host to run it. func (*PopWindow) Wait() bool { return false } // SetStack is a router's pages as the window's stack of screens, its first page and those deeper (Titles, told apart by Keys): the screens of the keys the stack shows stay, the others are pushed, popped or replaced; none take the stack away. Answered once the screen going out of sight holds what the surface shows, as the surface is about to show the page coming. type SetStack struct { ID int Titles []string Keys []string } func (m *SetStack) Encode(w *Writer) { w.Uvarint(CallSetStack) w.Int(m.ID) w.Strings(m.Titles) w.Strings(m.Keys) } // Wait reports whether the caller waits for the host to run it. func (*SetStack) Wait() bool { return true } type SetStackReply struct { } func (m *SetStackReply) Decode(r *Reader) { } // StackShown is the surface shows the page of the stack's last screen, after SetStack or StackPopped. type StackShown struct { ID int } func (m *StackShown) Encode(w *Writer) { w.Uvarint(CallStackShown) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*StackShown) Wait() bool { return false } type LoadURL struct { ID int URL string } func (m *LoadURL) Encode(w *Writer) { w.Uvarint(CallLoadURL) w.Int(m.ID) w.String(m.URL) } // Wait reports whether the caller waits for the host to run it. func (*LoadURL) Wait() bool { return false } type LoadHTML struct { ID int HTML string BaseURL string } func (m *LoadHTML) Encode(w *Writer) { w.Uvarint(CallLoadHTML) w.Int(m.ID) w.String(m.HTML) w.String(m.BaseURL) } // Wait reports whether the caller waits for the host to run it. func (*LoadHTML) Wait() bool { return false } type Reload struct { ID int IgnoreCache bool } func (m *Reload) Encode(w *Writer) { w.Uvarint(CallReload) w.Int(m.ID) w.Bool(m.IgnoreCache) } // Wait reports whether the caller waits for the host to run it. func (*Reload) Wait() bool { return false } type StopLoading struct { ID int } func (m *StopLoading) Encode(w *Writer) { w.Uvarint(CallStopLoading) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*StopLoading) Wait() bool { return false } type GoBack struct { ID int } func (m *GoBack) Encode(w *Writer) { w.Uvarint(CallGoBack) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*GoBack) Wait() bool { return false } type GoForward struct { ID int } func (m *GoForward) Encode(w *Writer) { w.Uvarint(CallGoForward) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*GoForward) Wait() bool { return false } type Eval struct { ID int JS string } func (m *Eval) Encode(w *Writer) { w.Uvarint(CallEval) w.Int(m.ID) w.String(m.JS) } // Wait reports whether the caller waits for the host to run it. func (*Eval) Wait() bool { return false } // CallAsync is runs Body as an async function's; AsyncResult answers. type CallAsync struct { ID int Req int Body string } func (m *CallAsync) Encode(w *Writer) { w.Uvarint(CallCallAsync) w.Int(m.ID) w.Int(m.Req) w.String(m.Body) } // Wait reports whether the caller waits for the host to run it. func (*CallAsync) Wait() bool { return false } type SetZoom struct { ID int Factor float64 } func (m *SetZoom) Encode(w *Writer) { w.Uvarint(CallSetZoom) w.Int(m.ID) w.Float(m.Factor) } // Wait reports whether the caller waits for the host to run it. func (*SetZoom) Wait() bool { return false } type SetUserAgent struct { ID int UserAgent string } func (m *SetUserAgent) Encode(w *Writer) { w.Uvarint(CallSetUserAgent) w.Int(m.ID) w.String(m.UserAgent) } // Wait reports whether the caller waits for the host to run it. func (*SetUserAgent) Wait() bool { return false } type SetUserScripts struct { ID int Scripts []string ScriptFlags []string } func (m *SetUserScripts) Encode(w *Writer) { w.Uvarint(CallSetUserScripts) w.Int(m.ID) w.Strings(m.Scripts) w.Strings(m.ScriptFlags) } // Wait reports whether the caller waits for the host to run it. func (*SetUserScripts) Wait() bool { return false } // CapturePage is a PNG of the page; Captured answers. type CapturePage struct { ID int Req int } func (m *CapturePage) Encode(w *Writer) { w.Uvarint(CallCapturePage) w.Int(m.ID) w.Int(m.Req) } // Wait reports whether the caller waits for the host to run it. func (*CapturePage) Wait() bool { return false } type UserAgent struct { ID int } func (m *UserAgent) Encode(w *Writer) { w.Uvarint(CallUserAgent) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*UserAgent) Wait() bool { return true } type UserAgentReply struct { UserAgent string } func (m *UserAgentReply) Decode(r *Reader) { m.UserAgent = r.String() } // SchemeRespond is the status and headers of a SchemeRequest (Header: names and values in turn). type SchemeRespond struct { Req int Status int Header []string } func (m *SchemeRespond) Encode(w *Writer) { w.Uvarint(CallSchemeRespond) w.Int(m.Req) w.Int(m.Status) w.Strings(m.Header) } // Wait reports whether the caller waits for the host to run it. func (*SchemeRespond) Wait() bool { return false } type SchemeData struct { Req int Data []byte } func (m *SchemeData) Encode(w *Writer) { w.Uvarint(CallSchemeData) w.Int(m.Req) w.Bytes(m.Data) } // Wait reports whether the caller waits for the host to run it. func (*SchemeData) Wait() bool { return false } type SchemeFinish struct { Req int } func (m *SchemeFinish) Encode(w *Writer) { w.Uvarint(CallSchemeFinish) w.Int(m.Req) } // Wait reports whether the caller waits for the host to run it. func (*SchemeFinish) Wait() bool { return false } type SchemeFail struct { Req int Message string } func (m *SchemeFail) Encode(w *Writer) { w.Uvarint(CallSchemeFail) w.Int(m.Req) w.String(m.Message) } // Wait reports whether the caller waits for the host to run it. func (*SchemeFail) Wait() bool { return false } // MessageBox is an alert; MessageBoxResult answers. type MessageBox struct { Req int Type string Title string Message string Detail string Buttons []string DefaultID int CancelID int } func (m *MessageBox) Encode(w *Writer) { w.Uvarint(CallMessageBox) w.Int(m.Req) w.String(m.Type) w.String(m.Title) w.String(m.Message) w.String(m.Detail) w.Strings(m.Buttons) w.Int(m.DefaultID) w.Int(m.CancelID) } // Wait reports whether the caller waits for the host to run it. func (*MessageBox) Wait() bool { return false } // OpenFiles is the system's picker of documents; FilesResult answers with copies the app may read. type OpenFiles struct { Req int Multiple bool Directories bool Extensions []string } func (m *OpenFiles) Encode(w *Writer) { w.Uvarint(CallOpenFiles) w.Int(m.Req) w.Bool(m.Multiple) w.Bool(m.Directories) w.Strings(m.Extensions) } // Wait reports whether the caller waits for the host to run it. func (*OpenFiles) Wait() bool { return false } // ShareFile is the share sheet of a file, as the place to save it. type ShareFile struct { Path string } func (m *ShareFile) Encode(w *Writer) { w.Uvarint(CallShareFile) w.String(m.Path) } // Wait reports whether the caller waits for the host to run it. func (*ShareFile) Wait() bool { return false } type ClipboardText struct { } func (m *ClipboardText) Encode(w *Writer) { w.Uvarint(CallClipboardText) } // Wait reports whether the caller waits for the host to run it. func (*ClipboardText) Wait() bool { return true } type ClipboardTextReply struct { Text string OK bool } func (m *ClipboardTextReply) Decode(r *Reader) { m.Text = r.String() m.OK = r.Bool() } type SetClipboardText struct { Text string } func (m *SetClipboardText) Encode(w *Writer) { w.Uvarint(CallSetClipboardText) w.String(m.Text) } // Wait reports whether the caller waits for the host to run it. func (*SetClipboardText) Wait() bool { return false } // OpenURL is opens a URL in the app the system has for it. type OpenURL struct { URL string } func (m *OpenURL) Encode(w *Writer) { w.Uvarint(CallOpenURL) w.String(m.URL) } // Wait reports whether the caller waits for the host to run it. func (*OpenURL) Wait() bool { return true } type OpenURLReply struct { OK bool } func (m *OpenURLReply) Decode(r *Reader) { m.OK = r.Bool() } type SecretGet struct { Service string Account string } func (m *SecretGet) Encode(w *Writer) { w.Uvarint(CallSecretGet) w.String(m.Service) w.String(m.Account) } // Wait reports whether the caller waits for the host to run it. func (*SecretGet) Wait() bool { return true } type SecretGetReply struct { Value []byte Found bool Error string } func (m *SecretGetReply) Decode(r *Reader) { m.Value = r.Bytes() m.Found = r.Bool() m.Error = r.String() } type SecretSet struct { Service string Account string Value []byte } func (m *SecretSet) Encode(w *Writer) { w.Uvarint(CallSecretSet) w.String(m.Service) w.String(m.Account) w.Bytes(m.Value) } // Wait reports whether the caller waits for the host to run it. func (*SecretSet) Wait() bool { return true } type SecretSetReply struct { Error string } func (m *SecretSetReply) Decode(r *Reader) { m.Error = r.String() } type SecretDelete struct { Service string Account string } func (m *SecretDelete) Encode(w *Writer) { w.Uvarint(CallSecretDelete) w.String(m.Service) w.String(m.Account) } // Wait reports whether the caller waits for the host to run it. func (*SecretDelete) Wait() bool { return true } type SecretDeleteReply struct { Error string } func (m *SecretDeleteReply) Decode(r *Reader) { m.Error = r.String() } // Notify is a local notification; NotifyDone answers once the system has it. type Notify struct { Req int NotificationID string Title string Subtitle string Body string Group string Silent bool } func (m *Notify) Encode(w *Writer) { w.Uvarint(CallNotify) w.Int(m.Req) w.String(m.NotificationID) w.String(m.Title) w.String(m.Subtitle) w.String(m.Body) w.String(m.Group) w.Bool(m.Silent) } // Wait reports whether the caller waits for the host to run it. func (*Notify) Wait() bool { return false } type RemoveNotification struct { NotificationID string } func (m *RemoveNotification) Encode(w *Writer) { w.Uvarint(CallRemoveNotification) w.String(m.NotificationID) } // Wait reports whether the caller waits for the host to run it. func (*RemoveNotification) Wait() bool { return false } type RemoveAllNotifications struct { } func (m *RemoveAllNotifications) Encode(w *Writer) { w.Uvarint(CallRemoveAllNotifications) } // Wait reports whether the caller waits for the host to run it. func (*RemoveAllNotifications) Wait() bool { return false } // KeepAwake is keeps the screen on while the app shows. type KeepAwake struct { On bool } func (m *KeepAwake) Encode(w *Writer) { w.Uvarint(CallKeepAwake) w.Bool(m.On) } // Wait reports whether the caller waits for the host to run it. func (*KeepAwake) Wait() bool { return false } type NetworkStatus struct { } func (m *NetworkStatus) Encode(w *Writer) { w.Uvarint(CallNetworkStatus) } // Wait reports whether the caller waits for the host to run it. func (*NetworkStatus) Wait() bool { return true } type NetworkStatusReply struct { Online bool Metered bool } func (m *NetworkStatusReply) Decode(r *Reader) { m.Online = r.Bool() m.Metered = r.Bool() } // WatchNetwork is starts NetworkChanged. type WatchNetwork struct { } func (m *WatchNetwork) Encode(w *Writer) { w.Uvarint(CallWatchNetwork) } // Wait reports whether the caller waits for the host to run it. func (*WatchNetwork) Wait() bool { return false } type Battery struct { } func (m *Battery) Encode(w *Writer) { w.Uvarint(CallBattery) } // Wait reports whether the caller waits for the host to run it. func (*Battery) Wait() bool { return true } type BatteryReply struct { Level float64 Charging bool LowPower bool } func (m *BatteryReply) Decode(r *Reader) { m.Level = r.Float() m.Charging = r.Bool() m.LowPower = r.Bool() } // SetSystemBars is the icons of the system's bars ("auto", "light" or "dark"), and whether the bars hide. type SetSystemBars struct { Style string Hidden bool } func (m *SetSystemBars) Encode(w *Writer) { w.Uvarint(CallSetSystemBars) w.String(m.Style) w.Bool(m.Hidden) } // Wait reports whether the caller waits for the host to run it. func (*SetSystemBars) Wait() bool { return false } // SetOrientations is the orientations the screen may take: 1 portrait, 2 upside down, 4 landscape left, 8 landscape right; 0 any. type SetOrientations struct { Mask int } func (m *SetOrientations) Encode(w *Writer) { w.Uvarint(CallSetOrientations) w.Int(m.Mask) } // Wait reports whether the caller waits for the host to run it. func (*SetOrientations) Wait() bool { return false } // Share is the share sheet of text, a link and files; ShareResult answers. type Share struct { Req int Text string URL string Paths []string X float64 Y float64 } func (m *Share) Encode(w *Writer) { w.Uvarint(CallShare) w.Int(m.Req) w.String(m.Text) w.String(m.URL) w.Strings(m.Paths) w.Float(m.X) w.Float(m.Y) } // Wait reports whether the caller waits for the host to run it. func (*Share) Wait() bool { return false } // SaveFile is the system's picker of where to keep a copy of Path under Name; FilesResult answers with the place, empty when dismissed. type SaveFile struct { Req int Path string Name string } func (m *SaveFile) Encode(w *Writer) { w.Uvarint(CallSaveFile) w.Int(m.Req) w.String(m.Path) w.String(m.Name) } // Wait reports whether the caller waits for the host to run it. func (*SaveFile) Wait() bool { return false } type ClipboardImage struct { } func (m *ClipboardImage) Encode(w *Writer) { w.Uvarint(CallClipboardImage) } // Wait reports whether the caller waits for the host to run it. func (*ClipboardImage) Wait() bool { return true } type ClipboardImageReply struct { PNG []byte } func (m *ClipboardImageReply) Decode(r *Reader) { m.PNG = r.Bytes() } type SetClipboardImage struct { PNG []byte } func (m *SetClipboardImage) Encode(w *Writer) { w.Uvarint(CallSetClipboardImage) w.Bytes(m.PNG) } // Wait reports whether the caller waits for the host to run it. func (*SetClipboardImage) Wait() bool { return false } // PopupMenu is the system's menu at a point of the window: Items are encoded by Go (encodeMenu); MenuPicked answers with the item's ID, 0 when dismissed. type PopupMenu struct { ID int Req int X float64 Y float64 Items []byte } func (m *PopupMenu) Encode(w *Writer) { w.Uvarint(CallPopupMenu) w.Int(m.ID) w.Int(m.Req) w.Float(m.X) w.Float(m.Y) w.Bytes(m.Items) } // Wait reports whether the caller waits for the host to run it. func (*PopupMenu) Wait() bool { return false } // SetBarItems is the buttons at the end of the window's navigation bar; BarItemClicked tells which: titles, symbols and icons by index. type SetBarItems struct { ID int Titles []string Symbols []string Icons []string } func (m *SetBarItems) Encode(w *Writer) { w.Uvarint(CallSetBarItems) w.Int(m.ID) w.Strings(m.Titles) w.Strings(m.Symbols) w.Strings(m.Icons) } // Wait reports whether the caller waits for the host to run it. func (*SetBarItems) Wait() bool { return false } // PluginCall is a call of a plugin's native code: Args and PluginResult's Result are JSON. type PluginCall struct { Req int Plugin string Method string Args string } func (m *PluginCall) Encode(w *Writer) { w.Uvarint(CallPluginCall) w.Int(m.Req) w.String(m.Plugin) w.String(m.Method) w.String(m.Args) } // Wait reports whether the caller waits for the host to run it. func (*PluginCall) Wait() bool { return false } // AudioOpen is opens the sound's output: stereo at Rate frames a second, holding about Ahead milliseconds; on the caller's thread. type AudioOpen struct { Rate int Ahead int } func (m *AudioOpen) Encode(w *Writer) { w.Uvarint(CallAudioOpen) w.Int(m.Rate) w.Int(m.Ahead) } // Wait reports whether the caller waits for the host to run it. func (*AudioOpen) Wait() bool { return true } type AudioOpenReply struct { Error string } func (m *AudioOpenReply) Decode(r *Reader) { m.Error = r.String() } // AudioWrite is plays interleaved stereo float32 samples after those written, waiting while the output holds enough; on the caller's thread. type AudioWrite struct { Samples []byte } func (m *AudioWrite) Encode(w *Writer) { w.Uvarint(CallAudioWrite) w.Bytes(m.Samples) } // Wait reports whether the caller waits for the host to run it. func (*AudioWrite) Wait() bool { return true } type AudioWriteReply struct { Error string } func (m *AudioWriteReply) Decode(r *Reader) { m.Error = r.String() } type AudioClose struct { } func (m *AudioClose) Encode(w *Writer) { w.Uvarint(CallAudioClose) } // Wait reports whether the caller waits for the host to run it. func (*AudioClose) Wait() bool { return true } type AudioCloseReply struct { } func (m *AudioCloseReply) Decode(r *Reader) { } // Haptic is "selection", "light", "medium", "heavy", "success", "warning" or "error". type Haptic struct { Kind string } func (m *Haptic) Encode(w *Writer) { w.Uvarint(CallHaptic) w.String(m.Kind) } // Wait reports whether the caller waits for the host to run it. func (*Haptic) Wait() bool { return false } // RequestFrame is asks for a Frame at the next refresh of the display. type RequestFrame struct { ID int } func (m *RequestFrame) Encode(w *Writer) { w.Uvarint(CallRequestFrame) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*RequestFrame) Wait() bool { return false } // SetTextInput is whether the keyboard shows and what for: the input's traits (platform.TextTraits), and its text. Show counts the requests to show the keyboard again. Offsets are UTF-16 units of the document, of which Text is the part around the selection, from Base; MarkStart is -1 without marked text. A window without Document takes text without one, as a terminal: the keyboard sees none. type SetTextInput struct { ID int Active bool Show int Serial int X float64 Y float64 Width float64 Height float64 Document bool Multiline bool Secure bool Keyboard string ReturnKey string Capitalize string Autocorrect string Autofill string Text string Base int Length int SelStart int SelEnd int MarkStart int MarkEnd int } func (m *SetTextInput) Encode(w *Writer) { w.Uvarint(CallSetTextInput) w.Int(m.ID) w.Bool(m.Active) w.Int(m.Show) w.Int(m.Serial) w.Float(m.X) w.Float(m.Y) w.Float(m.Width) w.Float(m.Height) w.Bool(m.Document) w.Bool(m.Multiline) w.Bool(m.Secure) w.String(m.Keyboard) w.String(m.ReturnKey) w.String(m.Capitalize) w.String(m.Autocorrect) w.String(m.Autofill) w.String(m.Text) w.Int(m.Base) w.Int(m.Length) w.Int(m.SelStart) w.Int(m.SelEnd) w.Int(m.MarkStart) w.Int(m.MarkEnd) } // Wait reports whether the caller waits for the host to run it. func (*SetTextInput) Wait() bool { return false } // SetCursor is the pointer's shape, for a mouse or a trackpad. type SetCursor struct { ID int Cursor string } func (m *SetCursor) Encode(w *Writer) { w.Uvarint(CallSetCursor) w.Int(m.ID) w.String(m.Cursor) } // Wait reports whether the caller waits for the host to run it. func (*SetCursor) Wait() bool { return false } // AccessibilityChanged is the tree of accessible elements changed; Focus names the one with the focus. type AccessibilityChanged struct { ID int Focus int } func (m *AccessibilityChanged) Encode(w *Writer) { w.Uvarint(CallAccessibilityChanged) w.Int(m.ID) w.Int(m.Focus) } // Wait reports whether the caller waits for the host to run it. func (*AccessibilityChanged) Wait() bool { return false } type Announce struct { Text string } func (m *Announce) Encode(w *Writer) { w.Uvarint(CallAnnounce) w.String(m.Text) } // Wait reports whether the caller waits for the host to run it. func (*Announce) Wait() bool { return false } // ShowMenu is the system's edit menu at a point, with the actions given (cut, copy, paste, selectAll); TextCommand answers. type ShowMenu struct { ID int X float64 Y float64 Actions []string } func (m *ShowMenu) Encode(w *Writer) { w.Uvarint(CallShowMenu) w.Int(m.ID) w.Float(m.X) w.Float(m.Y) w.Strings(m.Actions) } // Wait reports whether the caller waits for the host to run it. func (*ShowMenu) Wait() bool { return false } // SetBackAvailable is whether the content takes the system's back. type SetBackAvailable struct { ID int On bool } func (m *SetBackAvailable) Encode(w *Writer) { w.Uvarint(CallSetBackAvailable) w.Int(m.ID) w.Bool(m.On) } // Wait reports whether the caller waits for the host to run it. func (*SetBackAvailable) Wait() bool { return false } // ShowMagnifier is the system's magnifier of what is at a point. type ShowMagnifier struct { ID int X float64 Y float64 } func (m *ShowMagnifier) Encode(w *Writer) { w.Uvarint(CallShowMagnifier) w.Int(m.ID) w.Float(m.X) w.Float(m.Y) } // Wait reports whether the caller waits for the host to run it. func (*ShowMagnifier) Wait() bool { return false } type HideMagnifier struct { ID int } func (m *HideMagnifier) Encode(w *Writer) { w.Uvarint(CallHideMagnifier) w.Int(m.ID) } // Wait reports whether the caller waits for the host to run it. func (*HideMagnifier) Wait() bool { return false } // TextMetrics is the metrics of a font (Android's Paint): ascent and descent, x-height, underline and strikethrough. type TextMetrics struct { Family string Size float64 Weight int Italic bool } func (m *TextMetrics) Encode(w *Writer) { w.Uvarint(CallTextMetrics) w.String(m.Family) w.Float(m.Size) w.Int(m.Weight) w.Bool(m.Italic) } // Wait reports whether the caller waits for the host to run it. func (*TextMetrics) Wait() bool { return true } type TextMetricsReply struct { Ascent float64 Descent float64 XHeight float64 UnderlinePosition float64 UnderlineThickness float64 StrikePosition float64 } func (m *TextMetricsReply) Decode(r *Reader) { m.Ascent = r.Float() m.Descent = r.Float() m.XHeight = r.Float() m.UnderlinePosition = r.Float() m.UnderlineThickness = r.Float() m.StrikePosition = r.Float() } // MeasureText is how wide each of Texts is in a font, kerned unless NoKern. type MeasureText struct { Family string Size float64 Weight int Italic bool NoKern bool Texts []string } func (m *MeasureText) Encode(w *Writer) { w.Uvarint(CallMeasureText) w.String(m.Family) w.Float(m.Size) w.Int(m.Weight) w.Bool(m.Italic) w.Bool(m.NoKern) w.Strings(m.Texts) } // Wait reports whether the caller waits for the host to run it. func (*MeasureText) Wait() bool { return true } type MeasureTextReply struct { Widths []float64 } func (m *MeasureTextReply) Decode(r *Reader) { m.Widths = r.Floats() } // TextAdvances is the advance of each UTF-16 unit of Text laid out as a whole (getTextRunAdvances). type TextAdvances struct { Family string Size float64 Weight int Italic bool NoKern bool Text string RTL bool } func (m *TextAdvances) Encode(w *Writer) { w.Uvarint(CallTextAdvances) w.String(m.Family) w.Float(m.Size) w.Int(m.Weight) w.Bool(m.Italic) w.Bool(m.NoKern) w.String(m.Text) w.Bool(m.RTL) } // Wait reports whether the caller waits for the host to run it. func (*TextAdvances) Wait() bool { return true } type TextAdvancesReply struct { Advances []float64 } func (m *TextAdvancesReply) Decode(r *Reader) { m.Advances = r.Floats() } // DrawText is draws Text in white at Scale pixels per DIP, its pen DX pixels right of a pixel's edge: its ink's box from the pen and its pixels, a byte of coverage each, or premultiplied RGBA when Color. type DrawText struct { Family string Size float64 Weight int Italic bool Text string Scale float64 DX float64 } func (m *DrawText) Encode(w *Writer) { w.Uvarint(CallDrawText) w.String(m.Family) w.Float(m.Size) w.Int(m.Weight) w.Bool(m.Italic) w.String(m.Text) w.Float(m.Scale) w.Float(m.DX) } // Wait reports whether the caller waits for the host to run it. func (*DrawText) Wait() bool { return true } type DrawTextReply struct { Left int Top int Width int Height int Color bool Pixels []byte } func (m *DrawTextReply) Decode(r *Reader) { m.Left = r.Int() m.Top = r.Int() m.Width = r.Int() m.Height = r.Int() m.Color = r.Bool() m.Pixels = r.Bytes() } // RegisterFont is adds a font file under Family, or its own family when empty. type RegisterFont struct { Data []byte Family string } func (m *RegisterFont) Encode(w *Writer) { w.Uvarint(CallRegisterFont) w.Bytes(m.Data) w.String(m.Family) } // Wait reports whether the caller waits for the host to run it. func (*RegisterFont) Wait() bool { return true } type RegisterFontReply struct { Family string Error string } func (m *RegisterFontReply) Decode(r *Reader) { m.Family = r.String() m.Error = r.String() } // ReadyEvent is the app finished launching. type ReadyEvent struct { } func (m *ReadyEvent) Decode(r *Reader) { } // ActiveEvent is the app is in front, or no longer. type ActiveEvent struct { Active bool } func (m *ActiveEvent) Decode(r *Reader) { m.Active = r.Bool() } // BackgroundEvent is the app goes to the background (true) or came back. The host waits: iOS ends apps that use the GPU in the background, so that frames stop before it returns. type BackgroundEvent struct { Background bool } func (m *BackgroundEvent) Decode(r *Reader) { m.Background = r.Bool() } type BackgroundReply struct { } func (m *BackgroundReply) Encode(w *Writer) { } type ThemeChangedEvent struct { } func (m *ThemeChangedEvent) Decode(r *Reader) { } type LocaleChangedEvent struct { } func (m *LocaleChangedEvent) Decode(r *Reader) { } type TimeZoneChangedEvent struct { ID string } func (m *TimeZoneChangedEvent) Decode(r *Reader) { m.ID = r.String() } type OpenURLsEvent struct { URLs []string } func (m *OpenURLsEvent) Decode(r *Reader) { m.URLs = r.Strings() } type MemoryWarningEvent struct { } func (m *MemoryWarningEvent) Decode(r *Reader) { } // TerminatingEvent is the process ends once Go answers. type TerminatingEvent struct { } func (m *TerminatingEvent) Decode(r *Reader) { } type TerminatingReply struct { } func (m *TerminatingReply) Encode(w *Writer) { } // ResizedEvent is the window's size in DIPs, the scale, and the insets of what covers it: the system's bars, the cutout, the keyboard. type ResizedEvent struct { ID int Width float64 Height float64 Scale float64 SafeTop float64 SafeLeft float64 SafeBottom float64 SafeRight float64 Keyboard float64 } func (m *ResizedEvent) Decode(r *Reader) { m.ID = r.Int() m.Width = r.Float() m.Height = r.Float() m.Scale = r.Float() m.SafeTop = r.Float() m.SafeLeft = r.Float() m.SafeBottom = r.Float() m.SafeRight = r.Float() m.Keyboard = r.Float() } // BackGestureEvent is the system's gesture of going back, as it goes: Phase is "started", "progress" or "cancelled". type BackGestureEvent struct { ID int Phase string Progress float64 } func (m *BackGestureEvent) Decode(r *Reader) { m.ID = r.Int() m.Phase = r.String() m.Progress = r.Float() } // StatusBarTappedEvent is a tap on iOS's status bar. type StatusBarTappedEvent struct { } func (m *StatusBarTappedEvent) Decode(r *Reader) { } // ViewPressedEvent is a finger went down on a view a surface holds, which takes it. type ViewPressedEvent struct { ID int X float64 Y float64 } func (m *ViewPressedEvent) Decode(r *Reader) { m.ID = r.Int() m.X = r.Float() m.Y = r.Float() } type PluginResultEvent struct { Req int Result string Error string Code string } func (m *PluginResultEvent) Decode(r *Reader) { m.Req = r.Int() m.Result = r.String() m.Error = r.String() m.Code = r.String() } // PluginEventEvent is an event of a plugin's native code: Data is JSON. type PluginEventEvent struct { Plugin string Name string Data string } func (m *PluginEventEvent) Decode(r *Reader) { m.Plugin = r.String() m.Name = r.String() m.Data = r.String() } type NetworkChangedEvent struct { Online bool Metered bool } func (m *NetworkChangedEvent) Decode(r *Reader) { m.Online = r.Bool() m.Metered = r.Bool() } type ShareResultEvent struct { Req int Error string } func (m *ShareResultEvent) Decode(r *Reader) { m.Req = r.Int() m.Error = r.String() } type MenuPickedEvent struct { Req int Item int } func (m *MenuPickedEvent) Decode(r *Reader) { m.Req = r.Int() m.Item = r.Int() } type BarItemClickedEvent struct { ID int Index int } func (m *BarItemClickedEvent) Decode(r *Reader) { m.ID = r.Int() m.Index = r.Int() } // TabSelectedEvent is the user chose tab Index. type TabSelectedEvent struct { ID int Index int } func (m *TabSelectedEvent) Decode(r *Reader) { m.ID = r.Int() m.Index = r.Int() } // StackPoppedEvent is the user took screens off a window's stack (SetStack): Depth stay. type StackPoppedEvent struct { ID int Depth int } func (m *StackPoppedEvent) Decode(r *Reader) { m.ID = r.Int() m.Depth = r.Int() } // PoppedEvent is the window left its stack: the back button, a swipe, Android's back, or PopWindow. type PoppedEvent struct { ID int } func (m *PoppedEvent) Decode(r *Reader) { m.ID = r.Int() } // BackPressedEvent is Android's back: whether the app took it. type BackPressedEvent struct { ID int } func (m *BackPressedEvent) Decode(r *Reader) { m.ID = r.Int() } type BackPressedReply struct { Handled bool } func (m *BackPressedReply) Encode(w *Writer) { w.Bool(m.Handled) } // MessageEvent is a message the page's bridge posted. type MessageEvent struct { ID int Text string } func (m *MessageEvent) Decode(r *Reader) { m.ID = r.Int() m.Text = r.String() } type WillNavigateEvent struct { ID int URL string MainFrame bool UserInitiated bool Unasked bool Reload bool } func (m *WillNavigateEvent) Decode(r *Reader) { m.ID = r.Int() m.URL = r.String() m.MainFrame = r.Bool() m.UserInitiated = r.Bool() m.Unasked = r.Bool() m.Reload = r.Bool() } type WillNavigateReply struct { Allow bool } func (m *WillNavigateReply) Encode(w *Writer) { w.Bool(m.Allow) } // NewWindowEvent is window.open or a link to _blank: whether the app opened it. type NewWindowEvent struct { ID int URL string UserInitiated bool } func (m *NewWindowEvent) Decode(r *Reader) { m.ID = r.Int() m.URL = r.String() m.UserInitiated = r.Bool() } type NewWindowReply struct { Handled bool } func (m *NewWindowReply) Encode(w *Writer) { w.Bool(m.Handled) } // PageStateEvent is what the page is at, after any change of it. type PageStateEvent struct { ID int URL string Title string Loading bool CanGoBack bool CanGoForward bool } func (m *PageStateEvent) Decode(r *Reader) { m.ID = r.Int() m.URL = r.String() m.Title = r.String() m.Loading = r.Bool() m.CanGoBack = r.Bool() m.CanGoForward = r.Bool() } type NavigationStartedEvent struct { ID int URL string } func (m *NavigationStartedEvent) Decode(r *Reader) { m.ID = r.Int() m.URL = r.String() } type NavigationCommittedEvent struct { ID int URL string } func (m *NavigationCommittedEvent) Decode(r *Reader) { m.ID = r.Int() m.URL = r.String() } type LoadFinishedEvent struct { ID int } func (m *LoadFinishedEvent) Decode(r *Reader) { m.ID = r.Int() } type LoadFailedEvent struct { ID int URL string Code int Description string } func (m *LoadFailedEvent) Decode(r *Reader) { m.ID = r.Int() m.URL = r.String() m.Code = r.Int() m.Description = r.String() } type ClosedByPageEvent struct { ID int } func (m *ClosedByPageEvent) Decode(r *Reader) { m.ID = r.Int() } // WindowFrontEvent is the user went to a window of its own scene, or (0) to the app's first. type WindowFrontEvent struct { ID int } func (m *WindowFrontEvent) Decode(r *Reader) { m.ID = r.Int() } type ProcessGoneEvent struct { ID int Reason string } func (m *ProcessGoneEvent) Decode(r *Reader) { m.ID = r.Int() m.Reason = r.String() } type PermissionRequestedEvent struct { ID int Kinds []string Origin string } func (m *PermissionRequestedEvent) Decode(r *Reader) { m.ID = r.Int() m.Kinds = r.Strings() m.Origin = r.String() } type PermissionRequestedReply struct { Allow bool } func (m *PermissionRequestedReply) Encode(w *Writer) { w.Bool(m.Allow) } // SchemeRequestEvent is a request of one of the app's schemes (Header: names and values in turn). type SchemeRequestEvent struct { ID int Req int Method string URL string Header []string Body []byte HasBody bool } func (m *SchemeRequestEvent) Decode(r *Reader) { m.ID = r.Int() m.Req = r.Int() m.Method = r.String() m.URL = r.String() m.Header = r.Strings() m.Body = r.Bytes() m.HasBody = r.Bool() } type SchemeCancelEvent struct { Req int } func (m *SchemeCancelEvent) Decode(r *Reader) { m.Req = r.Int() } type AsyncResultEvent struct { Req int Result string Error string } func (m *AsyncResultEvent) Decode(r *Reader) { m.Req = r.Int() m.Result = r.String() m.Error = r.String() } type CapturedEvent struct { Req int PNG []byte Error string } func (m *CapturedEvent) Decode(r *Reader) { m.Req = r.Int() m.PNG = r.Bytes() m.Error = r.String() } type MessageBoxResultEvent struct { Req int Response int } func (m *MessageBoxResultEvent) Decode(r *Reader) { m.Req = r.Int() m.Response = r.Int() } type FilesResultEvent struct { Req int Paths []string Error string } func (m *FilesResultEvent) Decode(r *Reader) { m.Req = r.Int() m.Paths = r.Strings() m.Error = r.String() } type NotifyDoneEvent struct { Req int Error string } func (m *NotifyDoneEvent) Decode(r *Reader) { m.Req = r.Int() m.Error = r.String() } type NotificationClickedEvent struct { NotificationID string } func (m *NotificationClickedEvent) Decode(r *Reader) { m.NotificationID = r.String() } // FrameEvent is the display refreshes: draw a frame if one was asked for. type FrameEvent struct { ID int } func (m *FrameEvent) Decode(r *Reader) { m.ID = r.Int() } // SurfaceChangedEvent is the native surface to draw on (a CAMetalLayer, an ANativeWindow), 0 when gone. type SurfaceChangedEvent struct { ID int Handle int Width float64 Height float64 Scale float64 Refresh float64 } func (m *SurfaceChangedEvent) Decode(r *Reader) { m.ID = r.Int() m.Handle = r.Int() m.Width = r.Float() m.Height = r.Float() m.Scale = r.Float() m.Refresh = r.Float() } // SurfaceDestroyedEvent is the native surface goes: the host waits for Go to let go of it. type SurfaceDestroyedEvent struct { ID int } func (m *SurfaceDestroyedEvent) Decode(r *Reader) { m.ID = r.Int() } type SurfaceDestroyedReply struct { } func (m *SurfaceDestroyedReply) Encode(w *Writer) { } // TouchEvent is a finger, a pen or a mouse: Phase is "down", "move", "up" or "cancel", Kind "touch", "pen" or "mouse". type TouchEvent struct { ID int Pointer int Phase string Kind string X float64 Y float64 Pressure float64 Buttons int Time float64 } func (m *TouchEvent) Decode(r *Reader) { m.ID = r.Int() m.Pointer = r.Int() m.Phase = r.String() m.Kind = r.String() m.X = r.Float() m.Y = r.Float() m.Pressure = r.Float() m.Buttons = r.Int() m.Time = r.Float() } // ScrollEvent is a mouse's or a trackpad's scrolling, in DIPs. type ScrollEvent struct { ID int X float64 Y float64 DX float64 DY float64 Precise bool Phase string } func (m *ScrollEvent) Decode(r *Reader) { m.ID = r.Int() m.X = r.Float() m.Y = r.Float() m.DX = r.Float() m.DY = r.Float() m.Precise = r.Bool() m.Phase = r.String() } // KeyEvent is a hardware keyboard's key: Down, its name (as ui names keys) and the text it types. type KeyEvent struct { ID int Down bool Key string Text string Mods int Repeated bool } func (m *KeyEvent) Decode(r *Reader) { m.ID = r.Int() m.Down = r.Bool() m.Key = r.String() m.Text = r.String() m.Mods = r.Int() m.Repeated = r.Bool() } type KeyReply struct { Handled bool } func (m *KeyReply) Encode(w *Writer) { w.Bool(m.Handled) } // TextReplaceEvent is the keyboard put Text in Start to End of the document, or with no range in place of the marked text or the selection; answers TextStateReply. type TextReplaceEvent struct { ID int HasRange bool Start int End int Text string } func (m *TextReplaceEvent) Decode(r *Reader) { m.ID = r.Int() m.HasRange = r.Bool() m.Start = r.Int() m.End = r.Int() m.Text = r.String() } type TextReplaceReply struct { } func (m *TextReplaceReply) Encode(w *Writer) { } // TextMarkEvent is the input method composes Text over Start to End, or with no range over the marked text or the selection; SelStart and SelEnd are in Text; answers TextStateReply. type TextMarkEvent struct { ID int HasRange bool Start int End int Text string SelStart int SelEnd int } func (m *TextMarkEvent) Decode(r *Reader) { m.ID = r.Int() m.HasRange = r.Bool() m.Start = r.Int() m.End = r.Int() m.Text = r.String() m.SelStart = r.Int() m.SelEnd = r.Int() } type TextMarkReply struct { } func (m *TextMarkReply) Encode(w *Writer) { } // TextUnmarkEvent is the marked text stays as text; answers TextStateReply. type TextUnmarkEvent struct { ID int } func (m *TextUnmarkEvent) Decode(r *Reader) { m.ID = r.Int() } type TextUnmarkReply struct { } func (m *TextUnmarkReply) Encode(w *Writer) { } // TextDeleteEvent is the keyboard deleted Before units before the selection and After after it; answers TextStateReply. type TextDeleteEvent struct { ID int Before int After int } func (m *TextDeleteEvent) Decode(r *Reader) { m.ID = r.Int() m.Before = r.Int() m.After = r.Int() } type TextDeleteReply struct { } func (m *TextDeleteReply) Encode(w *Writer) { } // TextSelectEvent is the keyboard moved the selection; answers TextStateReply. type TextSelectEvent struct { ID int Start int End int } func (m *TextSelectEvent) Decode(r *Reader) { m.ID = r.Int() m.Start = r.Int() m.End = r.Int() } type TextSelectReply struct { } func (m *TextSelectReply) Encode(w *Writer) { } // TextCommandEvent is an editing action of the keyboard or the edit menu: "newline", "tab", "deleteBackward", "deleteForward", "cut", "copy", "paste", "selectAll", "left", …; answers TextStateReply. type TextCommandEvent struct { ID int Command string } func (m *TextCommandEvent) Decode(r *Reader) { m.ID = r.Int() m.Command = r.String() } type TextCommandReply struct { } func (m *TextCommandReply) Encode(w *Writer) { } // TextStateEvent is the text around the selection, and the selection. type TextStateEvent struct { ID int } func (m *TextStateEvent) Decode(r *Reader) { m.ID = r.Int() } type TextStateReply struct { Text string Base int Length int SelStart int SelEnd int MarkStart int MarkEnd int X float64 Y float64 Width float64 Height float64 } func (m *TextStateReply) Encode(w *Writer) { w.String(m.Text) w.Int(m.Base) w.Int(m.Length) w.Int(m.SelStart) w.Int(m.SelEnd) w.Int(m.MarkStart) w.Int(m.MarkEnd) w.Float(m.X) w.Float(m.Y) w.Float(m.Width) w.Float(m.Height) } // TextRangeEvent is a part of the document outside the text the host has. type TextRangeEvent struct { ID int Start int End int } func (m *TextRangeEvent) Decode(r *Reader) { m.ID = r.Int() m.Start = r.Int() m.End = r.Int() } type TextRangeReply struct { Text string Start int End int } func (m *TextRangeReply) Encode(w *Writer) { w.String(m.Text) w.Int(m.Start) w.Int(m.End) } // TextBoundsEvent is where the range is on screen: its first line's rectangle. type TextBoundsEvent struct { ID int Start int End int } func (m *TextBoundsEvent) Decode(r *Reader) { m.ID = r.Int() m.Start = r.Int() m.End = r.Int() } type TextBoundsReply struct { OK bool X float64 Y float64 Width float64 Height float64 End int } func (m *TextBoundsReply) Encode(w *Writer) { w.Bool(m.OK) w.Float(m.X) w.Float(m.Y) w.Float(m.Width) w.Float(m.Height) w.Int(m.End) } // TextIndexAtEvent is the offset nearest a point of the window. type TextIndexAtEvent struct { ID int X float64 Y float64 } func (m *TextIndexAtEvent) Decode(r *Reader) { m.ID = r.Int() m.X = r.Float() m.Y = r.Float() } type TextIndexAtReply struct { OK bool Index int } func (m *TextIndexAtReply) Encode(w *Writer) { w.Bool(m.OK) w.Int(m.Index) } // TextInputEndedEvent is the keyboard went away. type TextInputEndedEvent struct { ID int } func (m *TextInputEndedEvent) Decode(r *Reader) { m.ID = r.Int() } // AccessibilityTreeEvent is the accessible elements, encoded as Nodes: for each, its ID, parent, role, label, value, hint, frame and actions. type AccessibilityTreeEvent struct { ID int } func (m *AccessibilityTreeEvent) Decode(r *Reader) { m.ID = r.Int() } type AccessibilityTreeReply struct { Nodes []byte } func (m *AccessibilityTreeReply) Encode(w *Writer) { w.Bytes(m.Nodes) } // AccessibilityActionEvent is an assistive technology's action on an element: "press", "increment", "decrement", "focus", "scrollForward", …. type AccessibilityActionEvent struct { ID int Node int Action string } func (m *AccessibilityActionEvent) Decode(r *Reader) { m.ID = r.Int() m.Node = r.Int() m.Action = r.String() } type AccessibilityActionReply struct { Handled bool } func (m *AccessibilityActionReply) Encode(w *Writer) { w.Bool(m.Handled) } // EventWaits reports whether the host waits for the reply of event op. func EventWaits(op uint64) bool { switch op { case EventBackground, EventTerminating, EventBackPressed, EventWillNavigate, EventNewWindow, EventPermissionRequested, EventSurfaceDestroyed, EventKey, EventTextReplace, EventTextMark, EventTextUnmark, EventTextDelete, EventTextSelect, EventTextCommand, EventTextState, EventTextRange, EventTextBounds, EventTextIndexAt, EventAccessibilityTree, EventAccessibilityAction: return true } return false }