mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-13 23:49:35 +08:00
ToggleDevTools -> OpenDevTools
More refactor CGO methods.
This commit is contained in:
parent
4cd4b46772
commit
a34ccbff33
@ -439,6 +439,11 @@ func main() {
|
|||||||
w.SetEnabled(true)
|
w.SetEnabled(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
stateMenu.Add("Open Dev Tools").OnClick(func(ctx *application.Context) {
|
||||||
|
currentWindow(func(w *application.WebviewWindow) {
|
||||||
|
w.OpenDevTools()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
stateMenu.Add("Flash Start").OnClick(func(ctx *application.Context) {
|
stateMenu.Add("Flash Start").OnClick(func(ctx *application.Context) {
|
||||||
|
@ -644,13 +644,14 @@ func getScreens(app pointer) ([]*Screen, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// widgets
|
// widgets
|
||||||
func widgetSetSensitive(widget pointer, enabled bool) {
|
|
||||||
value := C.int(0)
|
func (w *linuxWebviewWindow) setEnabled(enabled bool) {
|
||||||
|
var value C.int
|
||||||
if enabled {
|
if enabled {
|
||||||
value = C.int(1)
|
value = C.int(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
C.gtk_widget_set_sensitive((*C.GtkWidget)(widget), value)
|
C.gtk_widget_set_sensitive(w.gtkWidget(), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func widgetSetVisible(widget pointer, hidden bool) {
|
func widgetSetVisible(widget pointer, hidden bool) {
|
||||||
@ -692,32 +693,41 @@ func (w *linuxWebviewWindow) execJS(js string) {
|
|||||||
C.free(unsafe.Pointer(value))
|
C.free(unsafe.Pointer(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
func windowDestroy(window pointer) {
|
func (w *linuxWebviewWindow) destroy() {
|
||||||
// Should this truly 'destroy' ?
|
w.parent.markAsDestroyed()
|
||||||
C.gtk_window_close((*C.GtkWindow)(window))
|
// Free menu
|
||||||
//C.gtk_widget_destroy((*C.GtkWidget)(window))
|
if w.gtkmenu != nil {
|
||||||
|
C.gtk_widget_destroy((*C.GtkWidget)(w.gtkmenu))
|
||||||
|
w.gtkmenu = nil
|
||||||
|
}
|
||||||
|
w.destroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
func menuDestroy(gtkMenu pointer) {
|
func (w *linuxWebviewWindow) fullscreen() {
|
||||||
C.gtk_widget_destroy((*C.GtkWidget)(gtkMenu))
|
w.maximise()
|
||||||
|
//w.lastWidth, w.lastHeight = w.size()
|
||||||
|
x, y, width, height, scale := w.getCurrentMonitorGeometry()
|
||||||
|
if x == -1 && y == -1 && width == -1 && height == -1 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
w.setMinMaxSize(0, 0, width*scale, height*scale)
|
||||||
|
w.setSize(width*scale, height*scale)
|
||||||
|
C.gtk_window_fullscreen(w.gtkWindow())
|
||||||
|
w.setRelativePosition(0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func windowFullscreen(window pointer) {
|
func (w *linuxWebviewWindow) getCurrentMonitor() *C.GdkMonitor {
|
||||||
C.gtk_window_fullscreen((*C.GtkWindow)(window))
|
|
||||||
}
|
|
||||||
|
|
||||||
func windowGetCurrentMonitor(window pointer) *C.GdkMonitor {
|
|
||||||
// Get the monitor that the window is currently on
|
// Get the monitor that the window is currently on
|
||||||
display := C.gtk_widget_get_display((*C.GtkWidget)(window))
|
display := C.gtk_widget_get_display(w.gtkWidget())
|
||||||
gdk_window := C.gtk_widget_get_window((*C.GtkWidget)(window))
|
gdkWindow := C.gtk_widget_get_window(w.gtkWidget())
|
||||||
if gdk_window == nil {
|
if gdkWindow == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return C.gdk_display_get_monitor_at_window(display, gdk_window)
|
return C.gdk_display_get_monitor_at_window(display, gdkWindow)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *linuxWebviewWindow) getCurrentMonitorGeometry() (x int, y int, width int, height int, scale int) {
|
func (w *linuxWebviewWindow) getCurrentMonitorGeometry() (x int, y int, width int, height int, scale int) {
|
||||||
monitor := windowGetCurrentMonitor(w.window)
|
monitor := w.getCurrentMonitor()
|
||||||
if monitor == nil {
|
if monitor == nil {
|
||||||
return -1, -1, -1, -1, 1
|
return -1, -1, -1, -1, 1
|
||||||
}
|
}
|
||||||
@ -727,10 +737,10 @@ func (w *linuxWebviewWindow) getCurrentMonitorGeometry() (x int, y int, width in
|
|||||||
return int(result.x), int(result.y), int(result.width), int(result.height), scale
|
return int(result.x), int(result.y), int(result.width), int(result.height), scale
|
||||||
}
|
}
|
||||||
|
|
||||||
func windowGetSize(window pointer) (int, int) {
|
func (w *linuxWebviewWindow) size() (int, int) {
|
||||||
var windowWidth C.int
|
var windowWidth C.int
|
||||||
var windowHeight C.int
|
var windowHeight C.int
|
||||||
C.gtk_window_get_size((*C.GtkWindow)(window), &windowWidth, &windowHeight)
|
C.gtk_window_get_size(w.gtkWindow(), &windowWidth, &windowHeight)
|
||||||
return int(windowWidth), int(windowHeight)
|
return int(windowWidth), int(windowHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -738,7 +748,7 @@ func (w *linuxWebviewWindow) relativePosition() (int, int) {
|
|||||||
x, y := w.absolutePosition()
|
x, y := w.absolutePosition()
|
||||||
// The position must be relative to the screen it is on
|
// The position must be relative to the screen it is on
|
||||||
// We need to get the screen it is on
|
// We need to get the screen it is on
|
||||||
monitor := windowGetCurrentMonitor(w.window)
|
monitor := w.getCurrentMonitor()
|
||||||
geometry := C.GdkRectangle{}
|
geometry := C.GdkRectangle{}
|
||||||
C.gdk_monitor_get_geometry(monitor, &geometry)
|
C.gdk_monitor_get_geometry(monitor, &geometry)
|
||||||
x = x - int(geometry.x)
|
x = x - int(geometry.x)
|
||||||
@ -1014,7 +1024,7 @@ func (w *linuxWebviewWindow) setupSignalHandlers(emit func(e events.WindowEventT
|
|||||||
C.signal_connect(wv, c.String("key-press-event"), C.onKeyPressEvent, winID)
|
C.signal_connect(wv, c.String("key-press-event"), C.onKeyPressEvent, winID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func windowShowDevTools(webview pointer) {
|
func openDevTools(webview pointer) {
|
||||||
inspector := C.webkit_web_view_get_inspector((*C.WebKitWebView)(webview))
|
inspector := C.webkit_web_view_get_inspector((*C.WebKitWebView)(webview))
|
||||||
C.webkit_web_inspector_show(inspector)
|
C.webkit_web_inspector_show(inspector)
|
||||||
}
|
}
|
||||||
@ -1029,7 +1039,7 @@ func (w *linuxWebviewWindow) startDrag() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func windowToggleDevTools(webview pointer) {
|
func enableDevTools(webview pointer) {
|
||||||
settings := C.webkit_web_view_get_settings((*C.WebKitWebView)(webview))
|
settings := C.webkit_web_view_get_settings((*C.WebKitWebView)(webview))
|
||||||
enabled := C.webkit_settings_get_enable_developer_extras(settings)
|
enabled := C.webkit_settings_get_enable_developer_extras(settings)
|
||||||
switch enabled {
|
switch enabled {
|
||||||
|
@ -976,7 +976,7 @@ func windowSetupSignalHandlers(windowId uint, window, webview pointer, emit func
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
func windowToggleDevTools(webview pointer) {
|
func windowOpenDevTools(webview pointer) {
|
||||||
settings := webkitWebViewGetSettings(pointer(webview))
|
settings := webkitWebViewGetSettings(pointer(webview))
|
||||||
webkitSettingsSetEnableDeveloperExtras(
|
webkitSettingsSetEnableDeveloperExtras(
|
||||||
settings,
|
settings,
|
||||||
|
@ -167,8 +167,8 @@ func newRole(role Role) *MenuItem {
|
|||||||
return newForceReloadMenuItem()
|
return newForceReloadMenuItem()
|
||||||
case ToggleFullscreen:
|
case ToggleFullscreen:
|
||||||
return newToggleFullscreenMenuItem()
|
return newToggleFullscreenMenuItem()
|
||||||
case ShowDevTools:
|
case OpenDevTools:
|
||||||
return newShowDevToolsMenuItem()
|
return newOpenDevToolsMenuItem()
|
||||||
case ResetZoom:
|
case ResetZoom:
|
||||||
return newZoomResetMenuItem()
|
return newZoomResetMenuItem()
|
||||||
case ZoomIn:
|
case ZoomIn:
|
||||||
|
@ -576,17 +576,6 @@ func newToggleFullscreenMenuItem() *MenuItem {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func newToggleDevToolsMenuItem() *MenuItem {
|
|
||||||
return newMenuItem("Toggle Developer Tools").
|
|
||||||
SetAccelerator("Alt+Command+I").
|
|
||||||
OnClick(func(ctx *Context) {
|
|
||||||
currentWindow := globalApplication.CurrentWindow()
|
|
||||||
if currentWindow != nil {
|
|
||||||
currentWindow.ToggleDevTools()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func newZoomResetMenuItem() *MenuItem {
|
func newZoomResetMenuItem() *MenuItem {
|
||||||
// reset zoom menu item
|
// reset zoom menu item
|
||||||
return newMenuItem("Actual Size").
|
return newMenuItem("Actual Size").
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
package application
|
package application
|
||||||
|
|
||||||
func newShowDevToolsMenuItem() *MenuItem {
|
func newOpenDevToolsMenuItem() *MenuItem {
|
||||||
return newMenuItem("Show Developer Tools").
|
return newMenuItem("Open Developer Tools").
|
||||||
SetAccelerator("Alt+Command+I").
|
SetAccelerator("Alt+Command+I").
|
||||||
OnClick(func(ctx *Context) {
|
OnClick(func(ctx *Context) {
|
||||||
currentWindow := globalApplication.CurrentWindow()
|
currentWindow := globalApplication.CurrentWindow()
|
||||||
if currentWindow != nil {
|
if currentWindow != nil {
|
||||||
currentWindow.ToggleDevTools()
|
currentWindow.OpenDevTools()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -294,17 +294,6 @@ func newToggleFullscreenMenuItem() *MenuItem {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func newToggleDevToolsMenuItem() *MenuItem {
|
|
||||||
return newMenuItem("Toggle Developer Tools").
|
|
||||||
SetAccelerator("Alt+Command+I").
|
|
||||||
OnClick(func(ctx *Context) {
|
|
||||||
currentWindow := globalApplication.CurrentWindow()
|
|
||||||
if currentWindow != nil {
|
|
||||||
currentWindow.ToggleDevTools()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func newZoomResetMenuItem() *MenuItem {
|
func newZoomResetMenuItem() *MenuItem {
|
||||||
// reset zoom menu item
|
// reset zoom menu item
|
||||||
return newMenuItem("Actual Size").
|
return newMenuItem("Actual Size").
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
package application
|
package application
|
||||||
|
|
||||||
func newShowDevToolsMenuItem() *MenuItem {
|
func newOpenDevToolsMenuItem() *MenuItem {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ const (
|
|||||||
Close Role = iota
|
Close Role = iota
|
||||||
Reload Role = iota
|
Reload Role = iota
|
||||||
ForceReload Role = iota
|
ForceReload Role = iota
|
||||||
ShowDevTools Role = iota
|
OpenDevTools Role = iota
|
||||||
ResetZoom Role = iota
|
ResetZoom Role = iota
|
||||||
ZoomIn Role = iota
|
ZoomIn Role = iota
|
||||||
ZoomOut Role = iota
|
ZoomOut Role = iota
|
||||||
|
@ -3,5 +3,5 @@
|
|||||||
package application
|
package application
|
||||||
|
|
||||||
func addDevToolMenuItem(viewMenu *Menu) {
|
func addDevToolMenuItem(viewMenu *Menu) {
|
||||||
viewMenu.AddRole(ShowDevTools)
|
viewMenu.AddRole(OpenDevTools)
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ type (
|
|||||||
destroy()
|
destroy()
|
||||||
reload()
|
reload()
|
||||||
forceReload()
|
forceReload()
|
||||||
toggleDevTools()
|
openDevTools()
|
||||||
zoomReset()
|
zoomReset()
|
||||||
zoomIn()
|
zoomIn()
|
||||||
zoomOut()
|
zoomOut()
|
||||||
@ -817,11 +817,11 @@ func (w *WebviewWindow) ToggleMaximise() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *WebviewWindow) ToggleDevTools() {
|
func (w *WebviewWindow) OpenDevTools() {
|
||||||
if w.impl == nil && !w.isDestroyed() {
|
if w.impl == nil && !w.isDestroyed() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
InvokeSync(w.impl.toggleDevTools)
|
InvokeSync(w.impl.openDevTools)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZoomReset resets the zoom level of the webview content to 100%
|
// ZoomReset resets the zoom level of the webview content to 100%
|
||||||
|
@ -761,8 +761,6 @@ import (
|
|||||||
"github.com/wailsapp/wails/v3/pkg/events"
|
"github.com/wailsapp/wails/v3/pkg/events"
|
||||||
)
|
)
|
||||||
|
|
||||||
var showDevTools = func(window unsafe.Pointer) {}
|
|
||||||
|
|
||||||
type macosWebviewWindow struct {
|
type macosWebviewWindow struct {
|
||||||
nsWindow unsafe.Pointer
|
nsWindow unsafe.Pointer
|
||||||
parent *WebviewWindow
|
parent *WebviewWindow
|
||||||
@ -906,8 +904,8 @@ func (w *macosWebviewWindow) zoomReset() {
|
|||||||
C.windowZoomReset(w.nsWindow)
|
C.windowZoomReset(w.nsWindow)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *macosWebviewWindow) toggleDevTools() {
|
func (w *macosWebviewWindow) openDevTools() {
|
||||||
showDevTools(w.nsWindow)
|
openDevTools(w.nsWindow)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *macosWebviewWindow) reload() {
|
func (w *macosWebviewWindow) reload() {
|
||||||
|
@ -19,15 +19,7 @@ package application
|
|||||||
- (_WKInspector *)_inspector;
|
- (_WKInspector *)_inspector;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
//void showDevTools(void *window) {
|
void openDevTools(void *window) {
|
||||||
// // get main window
|
|
||||||
// WebviewWindow* nsWindow = (WebviewWindow*)window;
|
|
||||||
// dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
// [nsWindow.webView._inspector show];
|
|
||||||
// });
|
|
||||||
//}
|
|
||||||
|
|
||||||
void showDevTools(void *window) {
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
if (@available(macOS 12.0, *)) {
|
if (@available(macOS 12.0, *)) {
|
||||||
@ -55,12 +47,9 @@ void windowEnableDevTools(void* nsWindow) {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
import "unsafe"
|
|
||||||
|
|
||||||
func init() {
|
func (w *macosWebviewWindow) openDevTools() {
|
||||||
showDevTools = func(window unsafe.Pointer) {
|
openDevTools(w.nsWindow)
|
||||||
C.showDevTools(window)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *macosWebviewWindow) enableDevTools() {
|
func (w *macosWebviewWindow) enableDevTools() {
|
||||||
|
@ -3,3 +3,4 @@
|
|||||||
package application
|
package application
|
||||||
|
|
||||||
func (w *macosWebviewWindow) enableDevTools() {}
|
func (w *macosWebviewWindow) enableDevTools() {}
|
||||||
|
func (w *macosWebviewWindow) openDevTools() {}
|
||||||
|
@ -12,8 +12,6 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
)
|
)
|
||||||
|
|
||||||
var showDevTools = func(window pointer) {}
|
|
||||||
|
|
||||||
type dragInfo struct {
|
type dragInfo struct {
|
||||||
XRoot int
|
XRoot int
|
||||||
YRoot int
|
YRoot int
|
||||||
@ -103,19 +101,6 @@ func (w *linuxWebviewWindow) disableSizeConstraints() {
|
|||||||
w.setMinMaxSize(x, y, width*scale, height*scale)
|
w.setMinMaxSize(x, y, width*scale, height*scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *linuxWebviewWindow) fullscreen() {
|
|
||||||
w.maximise()
|
|
||||||
//w.lastWidth, w.lastHeight = w.size()
|
|
||||||
x, y, width, height, scale := w.getCurrentMonitorGeometry()
|
|
||||||
if x == -1 && y == -1 && width == -1 && height == -1 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
w.setMinMaxSize(0, 0, width*scale, height*scale)
|
|
||||||
w.setSize(width*scale, height*scale)
|
|
||||||
windowFullscreen(w.window)
|
|
||||||
w.setRelativePosition(0, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *linuxWebviewWindow) unminimise() {
|
func (w *linuxWebviewWindow) unminimise() {
|
||||||
w.present()
|
w.present()
|
||||||
}
|
}
|
||||||
@ -146,7 +131,7 @@ func (w *linuxWebviewWindow) center() {
|
|||||||
if x == -1 && y == -1 && width == -1 && height == -1 {
|
if x == -1 && y == -1 && width == -1 && height == -1 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
windowWidth, windowHeight := windowGetSize(w.window)
|
windowWidth, windowHeight := w.size()
|
||||||
|
|
||||||
newX := ((width - windowWidth) / 2) + x
|
newX := ((width - windowWidth) / 2) + x
|
||||||
newY := ((height - windowHeight) / 2) + y
|
newY := ((height - windowHeight) / 2) + y
|
||||||
@ -195,18 +180,6 @@ func (w *linuxWebviewWindow) setMaxSize(width, height int) {
|
|||||||
w.setMinMaxSize(w.parent.options.MinWidth, w.parent.options.MinHeight, width, height)
|
w.setMinMaxSize(w.parent.options.MinWidth, w.parent.options.MinHeight, width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *linuxWebviewWindow) showDevTools() {
|
|
||||||
windowShowDevTools(w.webview)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *linuxWebviewWindow) toggleDevTools() {
|
|
||||||
showDevTools(w.webview)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *linuxWebviewWindow) size() (int, int) {
|
|
||||||
return windowGetSize(w.window)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *linuxWebviewWindow) setRelativePosition(x, y int) {
|
func (w *linuxWebviewWindow) setRelativePosition(x, y int) {
|
||||||
mx, my, _, _, _ := w.getCurrentMonitorGeometry()
|
mx, my, _, _, _ := w.getCurrentMonitorGeometry()
|
||||||
w.move(x+mx, y+my)
|
w.move(x+mx, y+my)
|
||||||
@ -331,27 +304,13 @@ func (w *linuxWebviewWindow) run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if w.parent.options.DevToolsEnabled || globalApplication.isDebugMode {
|
if w.parent.options.DevToolsEnabled || globalApplication.isDebugMode {
|
||||||
w.toggleDevTools()
|
w.enableDevTools()
|
||||||
if w.parent.options.OpenInspectorOnStartup {
|
if w.parent.options.OpenInspectorOnStartup {
|
||||||
w.showDevTools()
|
w.openDevTools()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *linuxWebviewWindow) destroy() {
|
|
||||||
w.parent.markAsDestroyed()
|
|
||||||
// Free menu
|
|
||||||
if w.gtkmenu != nil {
|
|
||||||
menuDestroy(w.gtkmenu)
|
|
||||||
w.gtkmenu = nil
|
|
||||||
}
|
|
||||||
windowDestroy(w.window)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *linuxWebviewWindow) setEnabled(enabled bool) {
|
|
||||||
widgetSetSensitive(w.window, enabled)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *linuxWebviewWindow) startResize(border string) error {
|
func (w *linuxWebviewWindow) startResize(border string) error {
|
||||||
// FIXME: what do we need to do here?
|
// FIXME: what do we need to do here?
|
||||||
return nil
|
return nil
|
||||||
|
11
v3/pkg/application/webview_window_linux_dev.go
Normal file
11
v3/pkg/application/webview_window_linux_dev.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
//go:build linux && !production
|
||||||
|
|
||||||
|
package application
|
||||||
|
|
||||||
|
func (w *linuxWebviewWindow) openDevTools() {
|
||||||
|
openDevTools(w.webview)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *linuxWebviewWindow) enableDevTools() {
|
||||||
|
enableDevTools(w.webview)
|
||||||
|
}
|
@ -1,9 +0,0 @@
|
|||||||
//go:build linux && !production
|
|
||||||
|
|
||||||
package application
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
showDevTools = func(wv pointer) {
|
|
||||||
windowToggleDevTools(wv)
|
|
||||||
}
|
|
||||||
}
|
|
7
v3/pkg/application/webview_window_linux_production.go
Normal file
7
v3/pkg/application/webview_window_linux_production.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
//go:build linux && production && !devtools
|
||||||
|
|
||||||
|
package application
|
||||||
|
|
||||||
|
func (w *linuxWebviewWindow) openDevTools() {}
|
||||||
|
|
||||||
|
func (w *linuxWebviewWindow) enableDevTools() {}
|
@ -4,7 +4,7 @@ package application
|
|||||||
|
|
||||||
import "github.com/wailsapp/go-webview2/pkg/edge"
|
import "github.com/wailsapp/go-webview2/pkg/edge"
|
||||||
|
|
||||||
func (w *windowsWebviewWindow) toggleDevTools() {
|
func (w *windowsWebviewWindow) openDevTools() {
|
||||||
w.chromium.OpenDevToolsWindow()
|
w.chromium.OpenDevToolsWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ package application
|
|||||||
|
|
||||||
import "github.com/wailsapp/go-webview2/pkg/edge"
|
import "github.com/wailsapp/go-webview2/pkg/edge"
|
||||||
|
|
||||||
func (w *windowsWebviewWindow) toggleDevTools() {}
|
func (w *windowsWebviewWindow) openDevTools() {}
|
||||||
|
|
||||||
func (w *windowsWebviewWindow) enableDevTools(settings *edge.ICoreWebViewSettings) {
|
func (w *windowsWebviewWindow) enableDevTools(settings *edge.ICoreWebViewSettings) {
|
||||||
err := settings.PutAreDevToolsEnabled(false)
|
err := settings.PutAreDevToolsEnabled(false)
|
||||||
|
@ -65,7 +65,7 @@ type Window interface {
|
|||||||
SetZoom(magnification float64) Window
|
SetZoom(magnification float64) Window
|
||||||
Show() Window
|
Show() Window
|
||||||
Size() (width int, height int)
|
Size() (width int, height int)
|
||||||
ToggleDevTools()
|
OpenDevTools()
|
||||||
ToggleFullscreen()
|
ToggleFullscreen()
|
||||||
ToggleMaximise()
|
ToggleMaximise()
|
||||||
UnFullscreen()
|
UnFullscreen()
|
||||||
|
Loading…
Reference in New Issue
Block a user