mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
[v3] Rename AbsolutePosition() to Position() (#3611)
This commit is contained in:
parent
e51a481219
commit
d5e289880f
20 changed files with 97 additions and 90 deletions
|
|
@ -109,8 +109,8 @@ API: `SetEnabled(galluogwyd bool)`
|
|||
Mae'r swyddogaeth hon yn cael ei defnyddio i alluogi/analluogi'r ffenestr yn
|
||||
seiliedig ar y gwerth boolean a ddarperir.
|
||||
|
||||
### SetAbsolutePosition
|
||||
### SetPosition
|
||||
|
||||
API: `SetAbsolutePosition(x int, y int)`
|
||||
API: `SetPosition(x int, y int)`
|
||||
|
||||
Mae'r swyddogaeth hon yn gosod y safle absoliwt o'r ffenestr yn y sgrin.
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
Mae'r API Ffenestr wedi aros yn yr un fath i raddau helaeth, fodd bynnag mae'r dulliau yn awr ar enghraifft o ffenestr yn hytrach na'r amser gweithredu. Rhai gwahaniaeth nodedig yw:
|
||||
|
||||
- Mae gan Ffenestri nawr Enw sy'n eu hadnabod. Defnyddir hyn i adnabod y ffenestr wrth yrru digwyddiadau.
|
||||
- Mae gan Ffenestri lawer mwy o ddulliau ar y rhai nad oeddent ar gael o'r blaen, fel `AbsolutePosition` a `ToggleDevTools`.
|
||||
- Mae gan Ffenestri lawer mwy o ddulliau ar y rhai nad oeddent ar gael o'r blaen, fel `SetFrameless` a `ToggleDevTools`.
|
||||
- Gall Ffenestri nawr dderbyn ffeiliau drwy lusgo a gollwng brodorol. Gweler yr adran Lusgo a Gollwng am fwy o fanylion.
|
||||
|
||||
### ColourCefndir
|
||||
|
|
|
|||
|
|
@ -107,8 +107,8 @@ API: `SetEnabled(enabled bool)`
|
|||
This function is used to enable/disable the window based on the provided boolean
|
||||
value.
|
||||
|
||||
### SetAbsolutePosition
|
||||
### SetPosition
|
||||
|
||||
API: `SetAbsolutePosition(x int, y int)`
|
||||
API: `SetPosition(x int, y int)`
|
||||
|
||||
This function sets the absolute position of the window in the screen.
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Fixed appimage webkit file sourcing by [Atterpac](https://github.com/atterpac) in [#3306](https://github.com/wailsapp/wails/pull/3306).
|
||||
- Fixed Doctor apt package verify by [Atterpac](https://github.com/Atterpac) in [#2972](https://github.com/wailsapp/wails/pull/2972).
|
||||
- Fixed application frozen when quit (Darwin) by @5aaee9 in [#2982](https://github.com/wailsapp/wails/pull/2982)
|
||||
- Fixed background colours of examples on Windows by [mmgvh](https://github.com/mmghv) in [#2750](https://github.com/wailsapp/wails/pull/2750).
|
||||
- Fixed default context menus by [mmgvh](https://github.com/mmghv) in [#2753](https://github.com/wailsapp/wails/pull/2753).
|
||||
- Fixed background colours of examples on Windows by [mmghv](https://github.com/mmghv) in [#2750](https://github.com/wailsapp/wails/pull/2750).
|
||||
- Fixed default context menus by [mmghv](https://github.com/mmghv) in [#2753](https://github.com/wailsapp/wails/pull/2753).
|
||||
- Fixed hex values for arrow keys on Darwin by [jaybeecave](https://github.com/jaybeecave) in [#3052](https://github.com/wailsapp/wails/pull/3052).
|
||||
- Set drag-n-drop for windows to working. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/3039)
|
||||
- Fixed bug for linux in doctor in the event user doesn't have proper drivers installed. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/3032)
|
||||
|
|
@ -75,6 +75,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Changed
|
||||
|
||||
- Renamed `AbsolutePosition()` to `Position()` by [mmghv](https://github.com/mmghv) in [#3611](https://github.com/wailsapp/wails/pull/3611)
|
||||
- Update linux webkit dependency to webkit2gtk-4.1 over webkitgtk2-4.0 to support Ubuntu 24.04 LTS by [atterpac](https://github.com/atterpac) in [#3461](https://github.com/wailsapp/wails/pull/3461)
|
||||
- The bundled JS runtime script is now an ESM module: script tags importing it must have the `type="module"` attribute. By [@fbbdev](https://github.com/fbbdev) in [#3295](https://github.com/wailsapp/wails/pull/3295)
|
||||
- The `@wailsio/runtime` package does not publish its API on the `window.wails` object, and does not start the WML system. This has been done to improve encapsulation. The WML system can be started manually if desired by calling the new `WML.Enable` method. The bundled JS runtime script still performs both operations automatically. By [@fbbdev](https://github.com/fbbdev) in [#3295](https://github.com/wailsapp/wails/pull/3295)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ instance of a window rather than the runtime. Some notable differences are:
|
|||
|
||||
- Windows now have a Name that identifies them. This is used to identify the
|
||||
window when emitting events.
|
||||
- Windows have even more methods on the that were previously unavailable, such
|
||||
as `AbsolutePosition` and `ToggleDevTools`.
|
||||
- Windows have even more methods that were previously unavailable, such
|
||||
as `SetFrameless` and `ToggleDevTools`.
|
||||
- Windows can now accept files via native drag and drop. See the Drag and Drop
|
||||
section for more details.
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ func main() {
|
|||
SetURL("https://wails.io").
|
||||
Show()
|
||||
w.On(events.Common.WindowDidMove, func(event *application.WindowEvent) {
|
||||
x, y := w.AbsolutePosition()
|
||||
x, y := w.Position()
|
||||
fmt.Printf("WindowDidMove event triggered. New position: (%d, %d)\n", x, y)
|
||||
})
|
||||
windowCounter++
|
||||
|
|
@ -381,6 +381,25 @@ func main() {
|
|||
})
|
||||
|
||||
positionMenu := menu.AddSubmenu("Position")
|
||||
positionMenu.Add("Set Position (0,0)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetPosition(0, 0)
|
||||
})
|
||||
})
|
||||
|
||||
positionMenu.Add("Set Position (Random)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetPosition(rand.Intn(1000), rand.Intn(800))
|
||||
})
|
||||
})
|
||||
|
||||
positionMenu.Add("Get Position").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
x, y := w.Position()
|
||||
application.InfoDialog().SetTitle("Current WebviewWindow Position").SetMessage("X: " + strconv.Itoa(x) + " Y: " + strconv.Itoa(y)).Show()
|
||||
})
|
||||
})
|
||||
|
||||
positionMenu.Add("Set Relative Position (0,0)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetRelativePosition(0, 0)
|
||||
|
|
@ -399,25 +418,6 @@ func main() {
|
|||
})
|
||||
})
|
||||
|
||||
positionMenu.Add("Set Absolute Position (0,0)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetAbsolutePosition(0, 0)
|
||||
})
|
||||
})
|
||||
|
||||
positionMenu.Add("Set Absolute Position (Random)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetAbsolutePosition(rand.Intn(1000), rand.Intn(800))
|
||||
})
|
||||
})
|
||||
|
||||
positionMenu.Add("Get Absolute Position").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
x, y := w.AbsolutePosition()
|
||||
application.InfoDialog().SetTitle("Current WebviewWindow Position").SetMessage("X: " + strconv.Itoa(x) + " Y: " + strconv.Itoa(y)).Show()
|
||||
})
|
||||
})
|
||||
|
||||
positionMenu.Add("Center").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.Center()
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -266,21 +266,21 @@ func main() {
|
|||
})
|
||||
})
|
||||
|
||||
positionMenu.Add("Set Absolute Position (0,0)").OnClick(func(ctx *application.Context) {
|
||||
positionMenu.Add("Set Position (0,0)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetAbsolutePosition(0, 0)
|
||||
w.SetPosition(0, 0)
|
||||
})
|
||||
})
|
||||
|
||||
positionMenu.Add("Set Absolute Position (Random)").OnClick(func(ctx *application.Context) {
|
||||
positionMenu.Add("Set Position (Random)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetAbsolutePosition(rand.Intn(1000), rand.Intn(800))
|
||||
w.SetPosition(rand.Intn(1000), rand.Intn(800))
|
||||
})
|
||||
})
|
||||
|
||||
positionMenu.Add("Get Absolute Position").OnClick(func(ctx *application.Context) {
|
||||
positionMenu.Add("Get Position").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
x, y := w.AbsolutePosition()
|
||||
x, y := w.Position()
|
||||
application.InfoDialog().SetTitle("Current WebviewWindow Position").SetMessage("X: " + strconv.Itoa(x) + " Y: " + strconv.Itoa(y)).Show()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ The electron alternative for Go
|
|||
|
||||
import {newRuntimeCallerWithID, objectNames} from "./runtime";
|
||||
|
||||
const AbsolutePositionMethod = 0;
|
||||
const PositionMethod = 0;
|
||||
const CenterMethod = 1;
|
||||
const CloseMethod = 2;
|
||||
const DisableSizeConstraintsMethod = 3;
|
||||
|
|
@ -60,7 +60,7 @@ const RelativePositionMethod = 20;
|
|||
const ReloadMethod = 21;
|
||||
const ResizableMethod = 22;
|
||||
const RestoreMethod = 23;
|
||||
const SetAbsolutePositionMethod = 24;
|
||||
const SetPositionMethod = 24;
|
||||
const SetAlwaysOnTopMethod = 25;
|
||||
const SetBackgroundColourMethod = 26;
|
||||
const SetFramelessMethod = 27;
|
||||
|
|
@ -128,13 +128,13 @@ class Window {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the absolute position of the window to the screen.
|
||||
* Returns the absolute position of the window.
|
||||
*
|
||||
* @public
|
||||
* @return {Promise<Position>} - The current absolute position of the window.
|
||||
*/
|
||||
AbsolutePosition() {
|
||||
return this[caller](AbsolutePositionMethod);
|
||||
Position() {
|
||||
return this[caller](PositionMethod);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -368,15 +368,15 @@ class Window {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the absolute position of the window to the screen.
|
||||
* Sets the absolute position of the window.
|
||||
*
|
||||
* @public
|
||||
* @param {number} x - The desired horizontal absolute position of the window
|
||||
* @param {number} y - The desired vertical absolute position of the window
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
SetAbsolutePosition(x, y) {
|
||||
return this[caller](SetAbsolutePositionMethod, { x, y });
|
||||
SetPosition(x, y) {
|
||||
return this[caller](SetPositionMethod, { x, y });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -49,12 +49,12 @@ declare class Window {
|
|||
*/
|
||||
public Get(name: string): Window;
|
||||
/**
|
||||
* Returns the absolute position of the window to the screen.
|
||||
* Returns the absolute position of the window.
|
||||
*
|
||||
* @public
|
||||
* @return {Promise<Position>} - The current absolute position of the window.
|
||||
*/
|
||||
public AbsolutePosition(): Promise<Position>;
|
||||
public Position(): Promise<Position>;
|
||||
/**
|
||||
* Centers the window on the screen.
|
||||
*
|
||||
|
|
@ -217,14 +217,14 @@ declare class Window {
|
|||
*/
|
||||
public Restore(): Promise<void>;
|
||||
/**
|
||||
* Sets the absolute position of the window to the screen.
|
||||
* Sets the absolute position of the window.
|
||||
*
|
||||
* @public
|
||||
* @param {number} x - The desired horizontal absolute position of the window
|
||||
* @param {number} y - The desired vertical absolute position of the window
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
public SetAbsolutePosition(x: number, y: number): Promise<void>;
|
||||
public SetPosition(x: number, y: number): Promise<void>;
|
||||
/**
|
||||
* Sets the window to be always on top.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -906,7 +906,7 @@ func (w *linuxWebviewWindow) size() (int, int) {
|
|||
}
|
||||
|
||||
func (w *linuxWebviewWindow) relativePosition() (int, int) {
|
||||
x, y := w.absolutePosition()
|
||||
x, y := w.position()
|
||||
// The position must be relative to the screen it is on
|
||||
// We need to get the screen it is on
|
||||
monitor := w.getCurrentMonitor()
|
||||
|
|
@ -926,7 +926,7 @@ func (w *linuxWebviewWindow) gtkWidget() *C.GtkWidget {
|
|||
|
||||
func (w *linuxWebviewWindow) hide() {
|
||||
// save position
|
||||
w.lastX, w.lastY = w.absolutePosition()
|
||||
w.lastX, w.lastY = w.position()
|
||||
C.gtk_widget_hide(w.gtkWidget())
|
||||
}
|
||||
|
||||
|
|
@ -1042,7 +1042,7 @@ func (w *linuxWebviewWindow) show() {
|
|||
return
|
||||
}
|
||||
C.gtk_widget_show_all(w.gtkWidget())
|
||||
//w.setAbsolutePosition(w.lastX, w.lastY)
|
||||
//w.setPosition(w.lastX, w.lastY)
|
||||
}
|
||||
|
||||
func windowIgnoreMouseEvents(window pointer, webview pointer, ignore bool) {
|
||||
|
|
@ -1357,7 +1357,7 @@ func (w *linuxWebviewWindow) move(x, y int) {
|
|||
C.gtk_window_move(w.gtkWindow(), C.int(x), C.int(y))
|
||||
}
|
||||
|
||||
func (w *linuxWebviewWindow) absolutePosition() (int, int) {
|
||||
func (w *linuxWebviewWindow) position() (int, int) {
|
||||
var x C.int
|
||||
var y C.int
|
||||
C.gtk_window_get_position((*C.GtkWindow)(w.window), &x, &y)
|
||||
|
|
|
|||
|
|
@ -703,7 +703,7 @@ func windowFullscreen(window pointer) {
|
|||
gtkWindowFullScreen(window)
|
||||
}
|
||||
|
||||
func windowGetAbsolutePosition(window pointer) (int, int) {
|
||||
func windowGetPosition(window pointer) (int, int) {
|
||||
var x, y int
|
||||
gtkWindowGetPosition(window, &x, &y)
|
||||
return x, y
|
||||
|
|
@ -736,7 +736,7 @@ func windowGetCurrentMonitorGeometry(window pointer) (x int, y int, width int, h
|
|||
}
|
||||
|
||||
func windowGetRelativePosition(window pointer) (int, int) {
|
||||
absX, absY := windowGetAbsolutePosition(window)
|
||||
absX, absY := windowGetPosition(window)
|
||||
x, y, _, _, _ := windowGetCurrentMonitorGeometry(window)
|
||||
|
||||
relX := absX - x
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
WindowAbsolutePosition = 0
|
||||
WindowPosition = 0
|
||||
WindowCenter = 1
|
||||
WindowClose = 2
|
||||
WindowDisableSizeConstraints = 3
|
||||
|
|
@ -29,7 +29,7 @@ const (
|
|||
WindowReload = 21
|
||||
WindowResizable = 22
|
||||
WindowRestore = 23
|
||||
WindowSetAbsolutePosition = 24
|
||||
WindowSetPosition = 24
|
||||
WindowSetAlwaysOnTop = 25
|
||||
WindowSetBackgroundColour = 26
|
||||
WindowSetFrameless = 27
|
||||
|
|
@ -56,7 +56,7 @@ const (
|
|||
)
|
||||
|
||||
var windowMethodNames = map[int]string{
|
||||
WindowAbsolutePosition: "AbsolutePosition",
|
||||
WindowPosition: "Position",
|
||||
WindowCenter: "Center",
|
||||
WindowClose: "Close",
|
||||
WindowDisableSizeConstraints: "DisableSizeConstraints",
|
||||
|
|
@ -80,7 +80,7 @@ var windowMethodNames = map[int]string{
|
|||
WindowReload: "Reload",
|
||||
WindowResizable: "Resizable",
|
||||
WindowRestore: "Restore",
|
||||
WindowSetAbsolutePosition: "SetAbsolutePosition",
|
||||
WindowSetPosition: "SetPosition",
|
||||
WindowSetAlwaysOnTop: "SetAlwaysOnTop",
|
||||
WindowSetBackgroundColour: "SetBackgroundColour",
|
||||
WindowSetFrameless: "SetFrameless",
|
||||
|
|
@ -115,8 +115,8 @@ func (m *MessageProcessor) processWindowMethod(method int, rw http.ResponseWrite
|
|||
}
|
||||
|
||||
switch method {
|
||||
case WindowAbsolutePosition:
|
||||
x, y := window.AbsolutePosition()
|
||||
case WindowPosition:
|
||||
x, y := window.Position()
|
||||
m.json(rw, map[string]interface{}{
|
||||
"x": x,
|
||||
"y": y,
|
||||
|
|
@ -194,16 +194,16 @@ func (m *MessageProcessor) processWindowMethod(method int, rw http.ResponseWrite
|
|||
case WindowRestore:
|
||||
window.Restore()
|
||||
m.ok(rw)
|
||||
case WindowSetAbsolutePosition:
|
||||
case WindowSetPosition:
|
||||
x := args.Int("x")
|
||||
if x == nil {
|
||||
m.Error("Invalid SetAbsolutePosition Message: 'x' value required")
|
||||
m.Error("Invalid SetPosition Message: 'x' value required")
|
||||
}
|
||||
y := args.Int("y")
|
||||
if y == nil {
|
||||
m.Error("Invalid SetAbsolutePosition Message: 'y' value required")
|
||||
m.Error("Invalid SetPosition Message: 'y' value required")
|
||||
}
|
||||
window.SetAbsolutePosition(*x, *y)
|
||||
window.SetPosition(*x, *y)
|
||||
m.ok(rw)
|
||||
case WindowSetAlwaysOnTop:
|
||||
alwaysOnTop := args.Bool("alwaysOnTop")
|
||||
|
|
@ -274,11 +274,11 @@ func (m *MessageProcessor) processWindowMethod(method int, rw http.ResponseWrite
|
|||
case WindowSetRelativePosition:
|
||||
x := args.Int("x")
|
||||
if x == nil {
|
||||
m.Error("Invalid SetAbsolutePosition Message: 'x' value required")
|
||||
m.Error("Invalid SetRelativePosition Message: 'x' value required")
|
||||
}
|
||||
y := args.Int("y")
|
||||
if y == nil {
|
||||
m.Error("Invalid SetAbsolutePosition Message: 'y' value required")
|
||||
m.Error("Invalid SetRelativePosition Message: 'y' value required")
|
||||
}
|
||||
window.SetRelativePosition(*x, *y)
|
||||
m.ok(rw)
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ func (s *linuxSystemTray) positionWindow(window *WebviewWindow, offset int) erro
|
|||
}
|
||||
|
||||
// Set the new position of the window
|
||||
window.SetAbsolutePosition(newX, newY)
|
||||
window.SetPosition(newX, newY)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,8 +82,8 @@ type (
|
|||
startResize(border string) error
|
||||
print() error
|
||||
setEnabled(enabled bool)
|
||||
absolutePosition() (int, int)
|
||||
setAbsolutePosition(x int, y int)
|
||||
position() (int, int)
|
||||
setPosition(x int, y int)
|
||||
flash(enabled bool)
|
||||
handleKeyEvent(acceleratorString string)
|
||||
getBorderSizes() *LRTB
|
||||
|
|
@ -788,14 +788,14 @@ func (w *WebviewWindow) RelativePosition() (int, int) {
|
|||
return x, y
|
||||
}
|
||||
|
||||
// AbsolutePosition returns the absolute position of the window to the screen
|
||||
func (w *WebviewWindow) AbsolutePosition() (int, int) {
|
||||
// Position returns the absolute position of the window to the screen
|
||||
func (w *WebviewWindow) Position() (int, int) {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
return 0, 0
|
||||
}
|
||||
var x, y int
|
||||
InvokeSync(func() {
|
||||
x, y = w.impl.absolutePosition()
|
||||
x, y = w.impl.position()
|
||||
})
|
||||
return x, y
|
||||
}
|
||||
|
|
@ -1165,13 +1165,13 @@ func (w *WebviewWindow) SetEnabled(enabled bool) {
|
|||
})
|
||||
}
|
||||
|
||||
func (w *WebviewWindow) SetAbsolutePosition(x int, y int) {
|
||||
func (w *WebviewWindow) SetPosition(x int, y int) {
|
||||
// set absolute position
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeSync(func() {
|
||||
w.impl.setAbsolutePosition(x, y)
|
||||
w.impl.setPosition(x, y)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -541,13 +541,13 @@ void windowGetRelativePosition(void* nsWindow, int* x, int* y) {
|
|||
}
|
||||
|
||||
// Get absolute window position
|
||||
void windowGetAbsolutePosition(void* nsWindow, int* x, int* y) {
|
||||
void windowGetPosition(void* nsWindow, int* x, int* y) {
|
||||
NSRect frame = [(WebviewWindow*)nsWindow frame];
|
||||
*x = frame.origin.x;
|
||||
*y = frame.origin.y;
|
||||
}
|
||||
|
||||
void windowSetAbsolutePosition(void* nsWindow, int x, int y) {
|
||||
void windowSetPosition(void* nsWindow, int x, int y) {
|
||||
NSRect frame = [(WebviewWindow*)nsWindow frame];
|
||||
frame.origin.x = x;
|
||||
frame.origin.y = y;
|
||||
|
|
@ -807,8 +807,8 @@ func (w *macosWebviewWindow) isFocused() bool {
|
|||
return bool(C.windowIsFocused(w.nsWindow))
|
||||
}
|
||||
|
||||
func (w *macosWebviewWindow) setAbsolutePosition(x int, y int) {
|
||||
C.windowSetAbsolutePosition(w.nsWindow, C.int(x), C.int(y))
|
||||
func (w *macosWebviewWindow) setPosition(x int, y int) {
|
||||
C.windowSetPosition(w.nsWindow, C.int(x), C.int(y))
|
||||
}
|
||||
|
||||
func (w *macosWebviewWindow) print() error {
|
||||
|
|
@ -1265,10 +1265,10 @@ func (w *macosWebviewWindow) relativePosition() (int, int) {
|
|||
return int(x), int(y)
|
||||
}
|
||||
|
||||
func (w *macosWebviewWindow) absolutePosition() (int, int) {
|
||||
func (w *macosWebviewWindow) position() (int, int) {
|
||||
var x, y C.int
|
||||
InvokeSync(func() {
|
||||
C.windowGetAbsolutePosition(w.nsWindow, &x, &y)
|
||||
C.windowGetPosition(w.nsWindow, &x, &y)
|
||||
})
|
||||
|
||||
return int(x), int(y)
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ func (w *linuxWebviewWindow) height() int {
|
|||
return height
|
||||
}
|
||||
|
||||
func (w *linuxWebviewWindow) setAbsolutePosition(x int, y int) {
|
||||
func (w *linuxWebviewWindow) setPosition(x int, y int) {
|
||||
// Set the window's absolute position
|
||||
w.move(x, y)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,13 +89,13 @@ func (w *windowsWebviewWindow) getBorderSizes() *LRTB {
|
|||
return &result
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) setAbsolutePosition(x int, y int) {
|
||||
func (w *windowsWebviewWindow) setPosition(x int, y int) {
|
||||
// Set the window's absolute position
|
||||
borderSize := w.getBorderSizes()
|
||||
w32.SetWindowPos(w.hwnd, 0, x-borderSize.Left, y-borderSize.Top, 0, 0, w32.SWP_NOSIZE|w32.SWP_NOZORDER)
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) absolutePosition() (int, int) {
|
||||
func (w *windowsWebviewWindow) position() (int, int) {
|
||||
rect := w32.GetWindowRect(w.hwnd)
|
||||
borderSizes := w.getBorderSizes()
|
||||
x := int(rect.Left) + borderSizes.Left
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ type Callback interface {
|
|||
|
||||
type Window interface {
|
||||
Callback
|
||||
AbsolutePosition() (int, int)
|
||||
Center()
|
||||
Close()
|
||||
Destroy()
|
||||
|
|
@ -45,13 +44,14 @@ type Window interface {
|
|||
Name() string
|
||||
On(eventType events.WindowEventType, callback func(event *WindowEvent)) func()
|
||||
OpenContextMenu(data *ContextMenuData)
|
||||
Position() (int, int)
|
||||
RegisterContextMenu(name string, menu *Menu)
|
||||
RelativePosition() (int, int)
|
||||
Reload()
|
||||
Resizable() bool
|
||||
Restore()
|
||||
Run()
|
||||
SetAbsolutePosition(x, y int)
|
||||
SetPosition(x, y int)
|
||||
SetAlwaysOnTop(b bool) Window
|
||||
SetBackgroundColour(colour RGBA) Window
|
||||
SetFrameless(frameless bool) Window
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue