2023-08-01 16:56:58 +02:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2022-05-27 13:38:45 +02:00
|
|
|
// SPDX-FileCopyrightText: 2002-2006 Marcus Geelnard
|
2023-08-03 18:11:13 +02:00
|
|
|
// SPDX-FileCopyrightText: 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
2022-05-27 13:38:45 +02:00
|
|
|
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
|
2022-04-19 17:49:43 +02:00
|
|
|
|
2023-10-03 16:07:53 +02:00
|
|
|
package glfw
|
2022-04-19 17:49:43 +02:00
|
|
|
|
2023-03-30 19:07:35 +02:00
|
|
|
import (
|
|
|
|
"golang.org/x/sys/windows"
|
|
|
|
)
|
2023-02-07 19:05:46 +01:00
|
|
|
|
2022-04-19 17:49:43 +02:00
|
|
|
const (
|
|
|
|
_GLFW_WNDCLASSNAME = "GLFW30"
|
|
|
|
)
|
|
|
|
|
2023-02-07 19:05:46 +01:00
|
|
|
type platformWindowState struct {
|
|
|
|
handle windows.HWND
|
|
|
|
bigIcon _HICON
|
|
|
|
smallIcon _HICON
|
|
|
|
|
|
|
|
cursorTracked bool
|
|
|
|
frameAction bool
|
|
|
|
iconified bool
|
|
|
|
maximized bool
|
|
|
|
transparent bool // Whether to enable framebuffer transparency on DWM
|
|
|
|
scaleToMonitor bool
|
|
|
|
|
|
|
|
// Cached size used to filter out duplicate events
|
|
|
|
width int
|
|
|
|
height int
|
|
|
|
|
|
|
|
// The last received cursor position, regardless of source
|
|
|
|
lastCursorPosX int
|
|
|
|
lastCursorPosY int
|
|
|
|
|
2023-12-17 14:42:34 +01:00
|
|
|
// The last received high surrogate when decoding pairs of UTF-16 messages
|
2023-02-07 19:05:46 +01:00
|
|
|
highSurrogate uint16
|
|
|
|
}
|
|
|
|
|
|
|
|
type platformMonitorState struct {
|
|
|
|
handle _HMONITOR
|
|
|
|
|
|
|
|
// This size matches the static size of DISPLAY_DEVICE.DeviceName
|
|
|
|
adapterName string
|
|
|
|
displayName string
|
|
|
|
modesPruned bool
|
|
|
|
modeChanged bool
|
|
|
|
}
|
|
|
|
|
|
|
|
type platformCursorState struct {
|
|
|
|
handle _HCURSOR
|
|
|
|
}
|
|
|
|
|
|
|
|
type platformTLSState struct {
|
|
|
|
allocated bool
|
|
|
|
index uint32
|
|
|
|
}
|
|
|
|
|
|
|
|
type platformLibraryWindowState struct {
|
|
|
|
instance _HINSTANCE
|
|
|
|
helperWindowHandle windows.HWND
|
|
|
|
deviceNotificationHandle _HDEVNOTIFY
|
|
|
|
acquiredMonitorCount int
|
|
|
|
clipboardString string
|
|
|
|
keycodes [512]Key
|
|
|
|
scancodes [KeyLast + 1]int
|
|
|
|
keynames [KeyLast + 1]string
|
|
|
|
|
2024-04-14 08:58:31 +02:00
|
|
|
// restoreCursorPosX and restoreCursorPosY indicates where to place the cursor when re-enabled
|
2023-02-07 19:05:46 +01:00
|
|
|
restoreCursorPosX float64
|
|
|
|
restoreCursorPosY float64
|
|
|
|
|
2024-04-14 08:58:31 +02:00
|
|
|
// disabledCursorWindow is the window whose disabled cursor mode is active
|
2023-02-07 19:05:46 +01:00
|
|
|
disabledCursorWindow *Window
|
2024-04-14 08:58:31 +02:00
|
|
|
// capturedCursorWindow is the window the cursor is captured in
|
2024-04-13 15:23:50 +02:00
|
|
|
capturedCursorWindow *Window
|
2023-02-07 19:05:46 +01:00
|
|
|
rawInput []byte
|
|
|
|
mouseTrailSize uint32
|
2024-04-14 08:58:31 +02:00
|
|
|
// isRemoteSession indicates if the process was started behind Remote Destop
|
|
|
|
isRemoteSession bool
|
|
|
|
// blankCursor is an invisible cursor, needed for special cases (see WM_INPUT handler)
|
|
|
|
blankCursor _HCURSOR
|
2023-02-07 19:05:46 +01:00
|
|
|
}
|