mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
[v3 linux] api changes (#2830)
This commit is contained in:
parent
841289f1d1
commit
4804b34208
5 changed files with 23 additions and 5 deletions
|
|
@ -28,11 +28,16 @@ type responseWriter struct {
|
|||
header http.Header
|
||||
wroteHeader bool
|
||||
finished bool
|
||||
code int
|
||||
|
||||
w io.WriteCloser
|
||||
wErr error
|
||||
}
|
||||
|
||||
func (rw *responseWriter) Code() int {
|
||||
return rw.code
|
||||
}
|
||||
|
||||
func (rw *responseWriter) Header() http.Header {
|
||||
if rw.header == nil {
|
||||
rw.header = http.Header{}
|
||||
|
|
@ -53,6 +58,7 @@ func (rw *responseWriter) Write(buf []byte) (int, error) {
|
|||
}
|
||||
|
||||
func (rw *responseWriter) WriteHeader(code int) {
|
||||
rw.code = code
|
||||
if rw.wroteHeader || rw.finished {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,9 +52,13 @@ type responseWriter struct {
|
|||
header http.Header
|
||||
wroteHeader bool
|
||||
finished bool
|
||||
code int
|
||||
w io.WriteCloser
|
||||
wErr error
|
||||
}
|
||||
|
||||
w io.WriteCloser
|
||||
wErr error
|
||||
func (rw *responseWriter) Code() int {
|
||||
return rw.code
|
||||
}
|
||||
|
||||
func (rw *responseWriter) Header() http.Header {
|
||||
|
|
@ -77,6 +81,8 @@ func (rw *responseWriter) Write(buf []byte) (int, error) {
|
|||
}
|
||||
|
||||
func (rw *responseWriter) WriteHeader(code int) {
|
||||
rw.code = code
|
||||
|
||||
// TODO? Is this ever called? I don't think so!
|
||||
if rw.wroteHeader || rw.finished {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ func (m *linuxApp) run() error {
|
|||
|
||||
// Add a hook to the ApplicationDidFinishLaunching event
|
||||
// FIXME: add Wails specific events - i.e. Shouldn't platform specific ones be translated to Wails events?
|
||||
m.parent.On(events.Mac.ApplicationDidFinishLaunching, func() {
|
||||
m.parent.On(events.Mac.ApplicationDidFinishLaunching, func(evt *Event) {
|
||||
// Do we need to do anything now?
|
||||
fmt.Println("events.Mac.ApplicationDidFinishLaunching received!")
|
||||
})
|
||||
|
|
@ -107,6 +107,12 @@ func (m *linuxApp) registerWindow(window pointer, id uint) {
|
|||
m.windowsLock.Unlock()
|
||||
}
|
||||
|
||||
func (m *linuxApp) isDarkMode() bool {
|
||||
// FIXME: How do we detect this?
|
||||
// Maybe this helps: https://askubuntu.com/questions/1469869/how-does-firefox-detect-light-dark-theme-change-on-kde-systems
|
||||
return false
|
||||
}
|
||||
|
||||
func newPlatformApp(parent *App) *linuxApp {
|
||||
name := strings.ToLower(strings.Replace(parent.options.Name, " ", "", -1))
|
||||
if name == "" {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ func (s *linuxSystemTray) setMenu(menu *Menu) {
|
|||
s.menu = menu
|
||||
}
|
||||
|
||||
func (s *linuxSystemTray) positionWindow(window *WebviewWindow) error {
|
||||
func (s *linuxSystemTray) positionWindow(window *WebviewWindow, offset int) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ func (w *linuxWebviewWindow) run() {
|
|||
}
|
||||
// We need to wait for the HTML to load before we can execute the javascript
|
||||
// FIXME: What event is this? DomReady?
|
||||
w.parent.On(events.Mac.WebViewDidFinishNavigation, func(_ *WindowEventContext) {
|
||||
w.parent.On(events.Mac.WebViewDidFinishNavigation, func(_ *WindowEvent) {
|
||||
if w.parent.options.JS != "" {
|
||||
w.execJS(w.parent.options.JS)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue