2019-11-26 16:29:30 +01:00
|
|
|
// Copyright 2019 The Ebiten Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package ebiten
|
|
|
|
|
|
|
|
import (
|
|
|
|
"image"
|
2021-04-17 10:19:36 +02:00
|
|
|
"sync/atomic"
|
2022-02-06 08:08:22 +01:00
|
|
|
|
|
|
|
"github.com/hajimehoshi/ebiten/v2/internal/ui"
|
2019-12-17 04:28:52 +01:00
|
|
|
)
|
|
|
|
|
2021-12-29 14:08:59 +01:00
|
|
|
// WindowResizingModeType represents a mode in which a user resizes the window.
|
|
|
|
//
|
2022-08-29 04:16:39 +02:00
|
|
|
// Regardless of the resizing mode, an Ebitengine application can still change the window size or make
|
|
|
|
// the window fullscreen by calling Ebitengine functions.
|
2024-09-15 10:17:10 +02:00
|
|
|
type WindowResizingModeType int
|
2021-12-29 14:08:59 +01:00
|
|
|
|
|
|
|
// WindowResizingModeTypes
|
|
|
|
const (
|
|
|
|
// WindowResizingModeDisabled indicates the mode to disallow resizing the window by a user.
|
2024-09-15 10:17:10 +02:00
|
|
|
WindowResizingModeDisabled WindowResizingModeType = WindowResizingModeType(ui.WindowResizingModeDisabled)
|
2021-12-29 14:08:59 +01:00
|
|
|
|
2022-04-15 07:27:21 +02:00
|
|
|
// WindowResizingModeOnlyFullscreenEnabled indicates the mode to disallow resizing the window,
|
2021-12-29 14:08:59 +01:00
|
|
|
// but allow to make the window fullscreen by a user.
|
|
|
|
// This works only on macOS so far.
|
|
|
|
// On the other platforms, this is the same as WindowResizingModeDisabled.
|
2024-09-15 10:17:10 +02:00
|
|
|
WindowResizingModeOnlyFullscreenEnabled WindowResizingModeType = WindowResizingModeType(ui.WindowResizingModeOnlyFullscreenEnabled)
|
2021-12-29 14:08:59 +01:00
|
|
|
|
|
|
|
// WindowResizingModeEnabled indicates the mode to allow resizing the window by a user.
|
2024-09-15 10:17:10 +02:00
|
|
|
WindowResizingModeEnabled WindowResizingModeType = WindowResizingModeType(ui.WindowResizingModeEnabled)
|
2021-12-29 14:08:59 +01:00
|
|
|
)
|
|
|
|
|
2020-03-20 13:46:23 +01:00
|
|
|
// IsWindowDecorated reports whether the window is decorated.
|
|
|
|
//
|
|
|
|
// IsWindowDecorated is concurrent-safe.
|
|
|
|
func IsWindowDecorated() bool {
|
2022-02-06 12:02:03 +01:00
|
|
|
return ui.Get().Window().IsDecorated()
|
2020-03-20 13:46:23 +01:00
|
|
|
}
|
|
|
|
|
2019-11-26 16:29:30 +01:00
|
|
|
// SetWindowDecorated sets the state if the window is decorated.
|
|
|
|
//
|
|
|
|
// The window is decorated by default.
|
|
|
|
//
|
|
|
|
// SetWindowDecorated works only on desktops.
|
2023-09-18 10:48:07 +02:00
|
|
|
// SetWindowDecorated does nothing if the platform is not a desktop.
|
2019-11-26 16:29:30 +01:00
|
|
|
//
|
|
|
|
// SetWindowDecorated is concurrent-safe.
|
|
|
|
func SetWindowDecorated(decorated bool) {
|
2022-02-06 12:02:03 +01:00
|
|
|
ui.Get().Window().SetDecorated(decorated)
|
2019-11-26 16:29:30 +01:00
|
|
|
}
|
|
|
|
|
2021-12-29 14:08:59 +01:00
|
|
|
// WindowResizingMode returns the current mode in which a user resizes the window.
|
|
|
|
//
|
|
|
|
// The default mode is WindowResizingModeDisabled.
|
|
|
|
//
|
|
|
|
// WindowResizingMode is concurrent-safe.
|
|
|
|
func WindowResizingMode() WindowResizingModeType {
|
2024-09-15 10:17:10 +02:00
|
|
|
return WindowResizingModeType(ui.Get().Window().ResizingMode())
|
2021-12-29 14:08:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetWindowResizingMode sets the mode in which a user resizes the window.
|
|
|
|
//
|
|
|
|
// SetWindowResizingMode is concurrent-safe.
|
|
|
|
func SetWindowResizingMode(mode WindowResizingModeType) {
|
2024-09-15 10:17:10 +02:00
|
|
|
ui.Get().Window().SetResizingMode(ui.WindowResizingMode(mode))
|
2021-12-29 14:08:59 +01:00
|
|
|
}
|
|
|
|
|
2019-12-22 10:08:02 +01:00
|
|
|
// IsWindowResizable reports whether the window is resizable by the user's dragging on desktops.
|
|
|
|
// On the other environments, IsWindowResizable always returns false.
|
2019-11-26 16:29:30 +01:00
|
|
|
//
|
2022-02-10 21:21:58 +01:00
|
|
|
// Deprecated: as of v2.3. Use WindowResizingMode instead.
|
2019-11-26 16:29:30 +01:00
|
|
|
func IsWindowResizable() bool {
|
2021-12-29 14:08:59 +01:00
|
|
|
return ui.Get().Window().ResizingMode() == ui.WindowResizingModeEnabled
|
2019-11-26 16:29:30 +01:00
|
|
|
}
|
|
|
|
|
2019-12-22 10:08:02 +01:00
|
|
|
// SetWindowResizable sets whether the window is resizable by the user's dragging on desktops.
|
|
|
|
// On the other environments, SetWindowResizable does nothing.
|
|
|
|
//
|
2022-02-10 21:21:58 +01:00
|
|
|
// Deprecated: as of v2.3, Use SetWindowResizingMode instead.
|
2019-12-22 10:08:02 +01:00
|
|
|
func SetWindowResizable(resizable bool) {
|
2021-12-29 14:08:59 +01:00
|
|
|
mode := ui.WindowResizingModeDisabled
|
|
|
|
if resizable {
|
|
|
|
mode = ui.WindowResizingModeEnabled
|
|
|
|
}
|
|
|
|
ui.Get().Window().SetResizingMode(mode)
|
2019-12-22 10:08:02 +01:00
|
|
|
}
|
|
|
|
|
2019-11-26 16:29:30 +01:00
|
|
|
// SetWindowTitle sets the title of the window.
|
|
|
|
//
|
2023-09-18 10:48:07 +02:00
|
|
|
// SetWindowTitle does nothing if the platform is not a desktop.
|
2019-11-26 16:29:30 +01:00
|
|
|
//
|
|
|
|
// SetWindowTitle is concurrent-safe.
|
|
|
|
func SetWindowTitle(title string) {
|
2022-02-06 12:02:03 +01:00
|
|
|
ui.Get().Window().SetTitle(title)
|
2019-11-26 16:29:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetWindowIcon sets the icon of the game window.
|
|
|
|
//
|
|
|
|
// If len(iconImages) is 0, SetWindowIcon reverts the icon to the default one.
|
|
|
|
//
|
|
|
|
// For desktops, see the document of glfwSetWindowIcon of GLFW 3.2:
|
|
|
|
//
|
2022-08-03 13:48:02 +02:00
|
|
|
// This function sets the icon of the specified window.
|
|
|
|
// If passed an array of candidate images, those of or closest to the sizes
|
|
|
|
// desired by the system are selected.
|
|
|
|
// If no images are specified, the window reverts to its default icon.
|
|
|
|
//
|
|
|
|
// The desired image sizes varies depending on platform and system settings.
|
|
|
|
// The selected images will be rescaled as needed.
|
|
|
|
// Good sizes include 16x16, 32x32 and 48x48.
|
2019-11-26 16:29:30 +01:00
|
|
|
//
|
|
|
|
// As macOS windows don't have icons, SetWindowIcon doesn't work on macOS.
|
|
|
|
//
|
2023-09-18 10:48:07 +02:00
|
|
|
// SetWindowIcon doesn't work if the platform is not a desktop.
|
2019-11-26 16:29:30 +01:00
|
|
|
//
|
|
|
|
// SetWindowIcon is concurrent-safe.
|
|
|
|
func SetWindowIcon(iconImages []image.Image) {
|
2022-02-06 12:02:03 +01:00
|
|
|
ui.Get().Window().SetIcon(iconImages)
|
2019-11-26 16:29:30 +01:00
|
|
|
}
|
2019-11-30 14:37:53 +01:00
|
|
|
|
|
|
|
// WindowPosition returns the window position.
|
2022-08-21 13:02:09 +02:00
|
|
|
// The origin position is the upper-left corner of the current monitor.
|
2020-03-28 11:51:44 +01:00
|
|
|
// The unit is device-independent pixels.
|
2019-11-30 14:37:53 +01:00
|
|
|
//
|
2019-12-16 02:52:53 +01:00
|
|
|
// WindowPosition panics if the main loop does not start yet.
|
2019-11-30 14:37:53 +01:00
|
|
|
//
|
2022-08-10 15:37:28 +02:00
|
|
|
// WindowPosition returns the original window position in fullscreen mode.
|
2019-11-30 16:39:04 +01:00
|
|
|
//
|
2023-09-18 10:48:07 +02:00
|
|
|
// WindowPosition returns (0, 0) if the platform is not a desktop.
|
2019-11-30 16:11:46 +01:00
|
|
|
//
|
|
|
|
// WindowPosition is concurrent-safe.
|
2019-11-30 15:22:23 +01:00
|
|
|
func WindowPosition() (x, y int) {
|
2022-02-06 12:02:03 +01:00
|
|
|
return ui.Get().Window().Position()
|
2019-11-30 14:37:53 +01:00
|
|
|
}
|
2019-11-30 15:22:23 +01:00
|
|
|
|
|
|
|
// SetWindowPosition sets the window position.
|
2022-08-21 13:02:09 +02:00
|
|
|
// The origin position is the upper-left corner of the current monitor.
|
2020-03-28 11:51:44 +01:00
|
|
|
// The unit is device-independent pixels.
|
2019-11-30 15:22:23 +01:00
|
|
|
//
|
2022-08-10 15:37:28 +02:00
|
|
|
// SetWindowPosition sets the original window position in fullscreen mode.
|
2019-11-30 16:39:04 +01:00
|
|
|
//
|
2023-09-18 10:48:07 +02:00
|
|
|
// SetWindowPosition does nothing if the platform is not a desktop.
|
2019-11-30 16:11:46 +01:00
|
|
|
//
|
|
|
|
// SetWindowPosition is concurrent-safe.
|
2019-11-30 15:22:23 +01:00
|
|
|
func SetWindowPosition(x, y int) {
|
2024-04-29 12:02:23 +02:00
|
|
|
windowPositionSetExplicitly.Store(true)
|
2022-02-06 12:02:03 +01:00
|
|
|
ui.Get().Window().SetPosition(x, y)
|
2019-11-30 15:22:23 +01:00
|
|
|
}
|
2019-12-17 04:28:52 +01:00
|
|
|
|
|
|
|
var (
|
2024-04-29 12:02:23 +02:00
|
|
|
windowPositionSetExplicitly atomic.Bool
|
2019-12-17 04:28:52 +01:00
|
|
|
)
|
|
|
|
|
2021-04-17 10:30:48 +02:00
|
|
|
func initializeWindowPositionIfNeeded(width, height int) {
|
2024-04-29 12:02:23 +02:00
|
|
|
if !windowPositionSetExplicitly.Load() {
|
2024-03-23 14:31:08 +01:00
|
|
|
sw, sh := ui.Get().Monitor().Size()
|
2023-08-30 14:02:04 +02:00
|
|
|
x, y := ui.InitialWindowPosition(sw, sh, width, height)
|
2022-02-06 12:02:03 +01:00
|
|
|
ui.Get().Window().SetPosition(x, y)
|
2019-12-17 04:28:52 +01:00
|
|
|
}
|
|
|
|
}
|
2019-12-16 02:52:53 +01:00
|
|
|
|
2019-12-22 04:52:50 +01:00
|
|
|
// WindowSize returns the window size on desktops.
|
|
|
|
// WindowSize returns (0, 0) on other environments.
|
|
|
|
//
|
2022-10-22 09:15:13 +02:00
|
|
|
// Even if the application is in fullscreen mode, WindowSize returns the original window size
|
2024-03-23 14:31:08 +01:00
|
|
|
// If you need the fullscreen dimensions, see Monitor().Size() instead.
|
2019-12-16 02:52:53 +01:00
|
|
|
//
|
|
|
|
// WindowSize is concurrent-safe.
|
|
|
|
func WindowSize() (int, int) {
|
2022-02-06 12:02:03 +01:00
|
|
|
return ui.Get().Window().Size()
|
2019-12-16 02:52:53 +01:00
|
|
|
}
|
|
|
|
|
2019-12-22 04:52:50 +01:00
|
|
|
// SetWindowSize sets the window size on desktops.
|
|
|
|
// SetWindowSize does nothing on other environments.
|
|
|
|
//
|
2022-10-22 09:15:13 +02:00
|
|
|
// Even if the application is in fullscreen mode, SetWindowSize sets the original window size.
|
2019-12-16 02:52:53 +01:00
|
|
|
//
|
2019-12-22 04:46:57 +01:00
|
|
|
// SetWindowSize panics if width or height is not a positive number.
|
|
|
|
//
|
2019-12-16 02:52:53 +01:00
|
|
|
// SetWindowSize is concurrent-safe.
|
|
|
|
func SetWindowSize(width, height int) {
|
2019-12-22 04:46:57 +01:00
|
|
|
if width <= 0 || height <= 0 {
|
|
|
|
panic("ebiten: width and height must be positive")
|
|
|
|
}
|
2022-02-06 12:02:03 +01:00
|
|
|
ui.Get().Window().SetSize(width, height)
|
2019-12-16 02:52:53 +01:00
|
|
|
}
|
2020-03-20 13:46:23 +01:00
|
|
|
|
2021-09-01 10:17:54 +02:00
|
|
|
// WindowSizeLimits returns the limitation of the window size on desktops.
|
2021-04-16 19:27:04 +02:00
|
|
|
// A negative value indicates the size is not limited.
|
|
|
|
//
|
2021-09-01 10:17:54 +02:00
|
|
|
// WindowSizeLimits is concurrent-safe.
|
2021-04-16 19:27:04 +02:00
|
|
|
func WindowSizeLimits() (minw, minh, maxw, maxh int) {
|
2022-02-06 12:02:03 +01:00
|
|
|
return ui.Get().Window().SizeLimits()
|
2021-04-16 19:27:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetWindowSizeLimits sets the limitation of the window size on desktops.
|
|
|
|
// A negative value indicates the size is not limited.
|
|
|
|
//
|
2021-09-01 10:17:54 +02:00
|
|
|
// SetWindowSizeLimits is concurrent-safe.
|
2021-04-16 19:27:04 +02:00
|
|
|
func SetWindowSizeLimits(minw, minh, maxw, maxh int) {
|
2022-02-06 12:02:03 +01:00
|
|
|
ui.Get().Window().SetSizeLimits(minw, minh, maxw, maxh)
|
2021-04-16 19:27:04 +02:00
|
|
|
}
|
|
|
|
|
2020-03-20 13:46:23 +01:00
|
|
|
// IsWindowFloating reports whether the window is always shown above all the other windows.
|
|
|
|
//
|
2023-09-18 10:48:07 +02:00
|
|
|
// IsWindowFloating returns false if the platform is not a desktop.
|
2020-03-21 11:26:28 +01:00
|
|
|
//
|
2020-03-20 13:46:23 +01:00
|
|
|
// IsWindowFloating is concurrent-safe.
|
|
|
|
func IsWindowFloating() bool {
|
2022-02-06 12:02:03 +01:00
|
|
|
return ui.Get().Window().IsFloating()
|
2020-03-20 13:46:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetWindowFloating sets the state whether the window is always shown above all the other windows.
|
|
|
|
//
|
2023-09-18 10:48:07 +02:00
|
|
|
// SetWindowFloating does nothing if the platform is not a desktop.
|
2020-03-21 11:26:28 +01:00
|
|
|
//
|
2020-03-20 13:46:23 +01:00
|
|
|
// SetWindowFloating is concurrent-safe.
|
|
|
|
func SetWindowFloating(float bool) {
|
2022-02-06 12:02:03 +01:00
|
|
|
ui.Get().Window().SetFloating(float)
|
2020-03-20 13:46:23 +01:00
|
|
|
}
|
2020-03-21 11:26:28 +01:00
|
|
|
|
|
|
|
// MaximizeWindow maximizes the window.
|
|
|
|
//
|
2022-08-10 15:37:28 +02:00
|
|
|
// MaximizeWindow does nothing when the window is not resizable (WindowResizingModeEnabled).
|
2020-03-21 11:26:28 +01:00
|
|
|
//
|
2023-09-18 10:48:07 +02:00
|
|
|
// MaximizeWindow does nothing if the platform is not a desktop.
|
2020-03-21 11:26:28 +01:00
|
|
|
//
|
|
|
|
// MaximizeWindow is concurrent-safe.
|
|
|
|
func MaximizeWindow() {
|
2022-02-06 12:02:03 +01:00
|
|
|
ui.Get().Window().Maximize()
|
2020-03-21 11:26:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsWindowMaximized reports whether the window is maximized or not.
|
|
|
|
//
|
2021-12-29 14:08:59 +01:00
|
|
|
// IsWindowMaximized returns false when the window is not resizable (WindowResizingModeEnabled).
|
2020-03-30 19:48:19 +02:00
|
|
|
//
|
2023-09-18 10:48:07 +02:00
|
|
|
// IsWindowMaximized always returns false if the platform is not a desktop.
|
2020-03-21 11:26:28 +01:00
|
|
|
//
|
|
|
|
// IsWindowMaximized is concurrent-safe.
|
|
|
|
func IsWindowMaximized() bool {
|
2022-02-06 12:02:03 +01:00
|
|
|
return ui.Get().Window().IsMaximized()
|
2020-03-21 11:26:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// MinimizeWindow minimizes the window.
|
|
|
|
//
|
|
|
|
// If the main loop does not start yet, MinimizeWindow does nothing.
|
|
|
|
//
|
2023-09-18 10:48:07 +02:00
|
|
|
// MinimizeWindow does nothing if the platform is not a desktop.
|
2020-03-21 11:26:28 +01:00
|
|
|
//
|
|
|
|
// MinimizeWindow is concurrent-safe.
|
|
|
|
func MinimizeWindow() {
|
2022-02-06 12:02:03 +01:00
|
|
|
ui.Get().Window().Minimize()
|
2020-03-21 11:26:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsWindowMinimized reports whether the window is minimized or not.
|
|
|
|
//
|
2023-09-18 10:48:07 +02:00
|
|
|
// IsWindowMinimized always returns false if the platform is not a desktop.
|
2020-03-21 11:26:28 +01:00
|
|
|
//
|
|
|
|
// IsWindowMinimized is concurrent-safe.
|
|
|
|
func IsWindowMinimized() bool {
|
2022-02-06 12:02:03 +01:00
|
|
|
return ui.Get().Window().IsMinimized()
|
2020-03-21 11:26:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// RestoreWindow restores the window from its maximized or minimized state.
|
|
|
|
//
|
2020-03-30 19:48:19 +02:00
|
|
|
// RestoreWindow panics when the window is not maximized nor minimized.
|
|
|
|
//
|
2020-03-21 11:26:28 +01:00
|
|
|
// RestoreWindow is concurrent-safe.
|
|
|
|
func RestoreWindow() {
|
2020-03-30 19:48:19 +02:00
|
|
|
if !IsWindowMaximized() && !IsWindowMinimized() {
|
|
|
|
panic("ebiten: RestoreWindow must be called on a maximized or a minimized window")
|
|
|
|
}
|
2022-02-06 12:02:03 +01:00
|
|
|
ui.Get().Window().Restore()
|
2020-03-21 11:26:28 +01:00
|
|
|
}
|
2021-06-13 13:52:14 +02:00
|
|
|
|
|
|
|
// IsWindowBeingClosed returns true when the user is trying to close the window on desktops.
|
|
|
|
// As the window is closed immediately by default,
|
|
|
|
// you might want to call SetWindowClosingHandled(true) to prevent the window is automatically closed.
|
|
|
|
//
|
2023-09-18 10:48:07 +02:00
|
|
|
// IsWindowBeingClosed always returns false if the platform is not a desktop.
|
2021-06-13 13:52:14 +02:00
|
|
|
//
|
|
|
|
// IsWindowBeingClosed is concurrent-safe.
|
|
|
|
func IsWindowBeingClosed() bool {
|
2023-01-21 15:34:20 +01:00
|
|
|
return theInputState.windowBeingClosed()
|
2021-06-13 13:52:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetWindowClosingHandled sets whether the window closing is handled or not on desktops. The default state is false.
|
|
|
|
//
|
|
|
|
// If the window closing is handled, the window is not closed immediately and
|
2023-01-28 11:06:38 +01:00
|
|
|
// the game can know whether the window is being closed or not by IsWindowBeingClosed.
|
2021-06-13 13:52:14 +02:00
|
|
|
// In this case, the window is not closed automatically.
|
|
|
|
// To end the game, you have to return an error value at the Game's Update function.
|
|
|
|
//
|
|
|
|
// SetWindowClosingHandled works only on desktops.
|
2023-09-18 10:48:07 +02:00
|
|
|
// SetWindowClosingHandled does nothing if the platform is not a desktop.
|
2021-06-13 13:52:14 +02:00
|
|
|
//
|
|
|
|
// SetWindowClosingHandled is concurrent-safe.
|
|
|
|
func SetWindowClosingHandled(handled bool) {
|
2022-02-06 12:02:03 +01:00
|
|
|
ui.Get().Window().SetClosingHandled(handled)
|
2021-06-13 13:52:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsWindowClosingHandled reports whether the window closing is handled or not on desktops by SetWindowClosingHandled.
|
|
|
|
//
|
2023-09-18 10:48:07 +02:00
|
|
|
// IsWindowClosingHandled always returns false if the platform is not a desktop.
|
2021-06-13 13:52:14 +02:00
|
|
|
//
|
|
|
|
// IsWindowClosingHandled is concurrent-safe.
|
|
|
|
func IsWindowClosingHandled() bool {
|
2022-02-06 12:02:03 +01:00
|
|
|
return ui.Get().Window().IsClosingHandled()
|
2021-06-13 13:52:14 +02:00
|
|
|
}
|
2023-09-18 10:48:07 +02:00
|
|
|
|
|
|
|
// SetWindowMousePassthrough sets whether a mouse cursor passthroughs the window or not on desktops. The default state is false.
|
|
|
|
//
|
2023-12-17 14:42:34 +01:00
|
|
|
// Even if this is set true, some platforms might require a window to be undecorated
|
2023-09-18 10:48:07 +02:00
|
|
|
// in order to make the mouse cursor passthrough the window.
|
|
|
|
//
|
|
|
|
// SetWindowMousePassthrough works only on desktops.
|
|
|
|
// SetWindowMousePassthrough does nothing if the platform is not a desktop.
|
|
|
|
//
|
|
|
|
// SetWindowMousePassthrough is concurrent-safe.
|
|
|
|
func SetWindowMousePassthrough(enabled bool) {
|
|
|
|
ui.Get().Window().SetMousePassthrough(enabled)
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsWindowMousePassthrough reports whether a mouse cursor passthroughs the window or not on desktops.
|
|
|
|
//
|
2023-12-17 14:42:34 +01:00
|
|
|
// IsWindowMousePassthrough always returns false if the platform is not a desktop.
|
2023-09-18 10:48:07 +02:00
|
|
|
//
|
|
|
|
// IsWindowMousePassthrough is concurrent-safe.
|
|
|
|
func IsWindowMousePassthrough() bool {
|
|
|
|
return ui.Get().Window().IsMousePassthrough()
|
|
|
|
}
|
2024-09-21 16:24:59 +02:00
|
|
|
|
|
|
|
// RequestAttention requests user attention to the current window and/or the current application.
|
|
|
|
//
|
|
|
|
// RequestAttention works only on desktops.
|
|
|
|
// RequestAttention does nothing if the platform is not a desktop.
|
|
|
|
//
|
|
|
|
// RequestAttention is concurrent-safe.
|
|
|
|
func RequestAttention() {
|
|
|
|
ui.Get().Window().RequestAttention()
|
|
|
|
}
|