mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-23 09:22:01 +01:00
parent
4a00bbc299
commit
abcacc26d8
@ -175,6 +175,7 @@ func (g *nativeGamepadsDesktop) init(gamepads *gamepads) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if g.dinput8 != 0 {
|
if g.dinput8 != 0 {
|
||||||
|
// TODO: Use _GetModuleHandleExW to align with GLFW v3.3.8.
|
||||||
m, err := _GetModuleHandleW()
|
m, err := _GetModuleHandleW()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -31,316 +31,318 @@ const (
|
|||||||
|
|
||||||
// For the definitions, see https://github.com/wine-mirror/wine
|
// For the definitions, see https://github.com/wine-mirror/wine
|
||||||
const (
|
const (
|
||||||
_BI_BITFIELDS = 3
|
_BI_BITFIELDS = 3
|
||||||
_CCHDEVICENAME = 32
|
_CCHDEVICENAME = 32
|
||||||
_CCHFORMNAME = 32
|
_CCHFORMNAME = 32
|
||||||
_CDS_TEST = 0x00000002
|
_CDS_TEST = 0x00000002
|
||||||
_CDS_FULLSCREEN = 0x00000004
|
_CDS_FULLSCREEN = 0x00000004
|
||||||
_CS_HREDRAW = 0x00000002
|
_CS_HREDRAW = 0x00000002
|
||||||
_CS_OWNDC = 0x00000020
|
_CS_OWNDC = 0x00000020
|
||||||
_CS_VREDRAW = 0x00000001
|
_CS_VREDRAW = 0x00000001
|
||||||
_CW_USEDEFAULT = int32(^0x7fffffff)
|
_CW_USEDEFAULT = int32(^0x7fffffff)
|
||||||
_DBT_DEVTYP_DEVICEINTERFACE = 0x00000005
|
_DBT_DEVTYP_DEVICEINTERFACE = 0x00000005
|
||||||
_DEVICE_NOTIFY_WINDOW_HANDLE = 0x00000000
|
_DEVICE_NOTIFY_WINDOW_HANDLE = 0x00000000
|
||||||
_DIB_RGB_COLORS = 0
|
_DIB_RGB_COLORS = 0
|
||||||
_DISP_CHANGE_SUCCESSFUL = 0
|
_DISP_CHANGE_SUCCESSFUL = 0
|
||||||
_DISP_CHANGE_RESTART = 1
|
_DISP_CHANGE_RESTART = 1
|
||||||
_DISP_CHANGE_FAILED = -1
|
_DISP_CHANGE_FAILED = -1
|
||||||
_DISP_CHANGE_BADMODE = -2
|
_DISP_CHANGE_BADMODE = -2
|
||||||
_DISP_CHANGE_NOTUPDATED = -3
|
_DISP_CHANGE_NOTUPDATED = -3
|
||||||
_DISP_CHANGE_BADFLAGS = -4
|
_DISP_CHANGE_BADFLAGS = -4
|
||||||
_DISP_CHANGE_BADPARAM = -5
|
_DISP_CHANGE_BADPARAM = -5
|
||||||
_DISP_CHANGE_BADDUALVIEW = -6
|
_DISP_CHANGE_BADDUALVIEW = -6
|
||||||
_DISPLAY_DEVICE_ACTIVE = 0x00000001
|
_DISPLAY_DEVICE_ACTIVE = 0x00000001
|
||||||
_DISPLAY_DEVICE_MODESPRUNED = 0x08000000
|
_DISPLAY_DEVICE_MODESPRUNED = 0x08000000
|
||||||
_DISPLAY_DEVICE_PRIMARY_DEVICE = 0x00000004
|
_DISPLAY_DEVICE_PRIMARY_DEVICE = 0x00000004
|
||||||
_DM_BITSPERPEL = 0x00040000
|
_DM_BITSPERPEL = 0x00040000
|
||||||
_DM_PELSWIDTH = 0x00080000
|
_DM_PELSWIDTH = 0x00080000
|
||||||
_DM_PELSHEIGHT = 0x00100000
|
_DM_PELSHEIGHT = 0x00100000
|
||||||
_DM_DISPLAYFREQUENCY = 0x00400000
|
_DM_DISPLAYFREQUENCY = 0x00400000
|
||||||
_DWM_BB_BLURREGION = 0x00000002
|
_DWM_BB_BLURREGION = 0x00000002
|
||||||
_DWM_BB_ENABLE = 0x00000001
|
_DWM_BB_ENABLE = 0x00000001
|
||||||
_EDS_ROTATEDMODE = 0x00000004
|
_EDS_ROTATEDMODE = 0x00000004
|
||||||
_ENUM_CURRENT_SETTINGS uint32 = 0xffffffff
|
_ENUM_CURRENT_SETTINGS uint32 = 0xffffffff
|
||||||
_GCLP_HICON = -14
|
_GCLP_HICON = -14
|
||||||
_GCLP_HICONSM = -34
|
_GCLP_HICONSM = -34
|
||||||
_GWL_EXSTYLE = -20
|
_GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS = 0x00000004
|
||||||
_GWL_STYLE = -16
|
_GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT = 0x00000002
|
||||||
_HTCLIENT = 1
|
_GWL_EXSTYLE = -20
|
||||||
_HORZSIZE = 4
|
_GWL_STYLE = -16
|
||||||
_HWND_NOTOPMOST windows.HWND = (1 << intSize) - 2
|
_HTCLIENT = 1
|
||||||
_HWND_TOP windows.HWND = 0
|
_HORZSIZE = 4
|
||||||
_HWND_TOPMOST windows.HWND = (1 << intSize) - 1
|
_HWND_NOTOPMOST windows.HWND = (1 << intSize) - 2
|
||||||
_ICON_BIG = 1
|
_HWND_TOP windows.HWND = 0
|
||||||
_ICON_SMALL = 0
|
_HWND_TOPMOST windows.HWND = (1 << intSize) - 1
|
||||||
_IDC_ARROW = 32512
|
_ICON_BIG = 1
|
||||||
_IDI_APPLICATION = 32512
|
_ICON_SMALL = 0
|
||||||
_IMAGE_CURSOR = 2
|
_IDC_ARROW = 32512
|
||||||
_IMAGE_ICON = 1
|
_IDI_APPLICATION = 32512
|
||||||
_KF_ALTDOWN = 0x2000
|
_IMAGE_CURSOR = 2
|
||||||
_KF_DLGMODE = 0x0800
|
_IMAGE_ICON = 1
|
||||||
_KF_EXTENDED = 0x0100
|
_KF_ALTDOWN = 0x2000
|
||||||
_KF_MENUMODE = 0x1000
|
_KF_DLGMODE = 0x0800
|
||||||
_KF_REPEAT = 0x4000
|
_KF_EXTENDED = 0x0100
|
||||||
_KF_UP = 0x8000
|
_KF_MENUMODE = 0x1000
|
||||||
_LOGPIXELSX = 88
|
_KF_REPEAT = 0x4000
|
||||||
_LOGPIXELSY = 90
|
_KF_UP = 0x8000
|
||||||
_LR_DEFAULTSIZE = 0x0040
|
_LOGPIXELSX = 88
|
||||||
_LR_SHARED = 0x8000
|
_LOGPIXELSY = 90
|
||||||
_LWA_ALPHA = 0x00000002
|
_LR_DEFAULTSIZE = 0x0040
|
||||||
_MAPVK_VK_TO_VSC = 0
|
_LR_SHARED = 0x8000
|
||||||
_MAPVK_VSC_TO_VK = 1
|
_LWA_ALPHA = 0x00000002
|
||||||
_MONITOR_DEFAULTTONEAREST = 0x00000002
|
_MAPVK_VK_TO_VSC = 0
|
||||||
_MOUSE_MOVE_ABSOLUTE = 0x01
|
_MAPVK_VSC_TO_VK = 1
|
||||||
_MSGFLT_ALLOW = 1
|
_MONITOR_DEFAULTTONEAREST = 0x00000002
|
||||||
_OCR_CROSS = 32515
|
_MOUSE_MOVE_ABSOLUTE = 0x01
|
||||||
_OCR_HAND = 32649
|
_MSGFLT_ALLOW = 1
|
||||||
_OCR_IBEAM = 32513
|
_OCR_CROSS = 32515
|
||||||
_OCR_NORMAL = 32512
|
_OCR_HAND = 32649
|
||||||
_OCR_SIZENS = 32645
|
_OCR_IBEAM = 32513
|
||||||
_OCR_SIZEWE = 32644
|
_OCR_NORMAL = 32512
|
||||||
_PM_NOREMOVE = 0x0000
|
_OCR_SIZENS = 32645
|
||||||
_PM_REMOVE = 0x0001
|
_OCR_SIZEWE = 32644
|
||||||
_PFD_DRAW_TO_WINDOW = 0x00000004
|
_PM_NOREMOVE = 0x0000
|
||||||
_PFD_DOUBLEBUFFER = 0x00000001
|
_PM_REMOVE = 0x0001
|
||||||
_PFD_GENERIC_ACCELERATED = 0x00001000
|
_PFD_DRAW_TO_WINDOW = 0x00000004
|
||||||
_PFD_GENERIC_FORMAT = 0x00000040
|
_PFD_DOUBLEBUFFER = 0x00000001
|
||||||
_PFD_STEREO = 0x00000002
|
_PFD_GENERIC_ACCELERATED = 0x00001000
|
||||||
_PFD_SUPPORT_OPENGL = 0x00000020
|
_PFD_GENERIC_FORMAT = 0x00000040
|
||||||
_PFD_TYPE_RGBA = 0
|
_PFD_STEREO = 0x00000002
|
||||||
_QS_ALLEVENTS = _QS_INPUT | _QS_POSTMESSAGE | _QS_TIMER | _QS_PAINT | _QS_HOTKEY
|
_PFD_SUPPORT_OPENGL = 0x00000020
|
||||||
_QS_HOTKEY = 0x0080
|
_PFD_TYPE_RGBA = 0
|
||||||
_QS_INPUT = _QS_MOUSE | _QS_KEY | _QS_RAWINPUT
|
_QS_ALLEVENTS = _QS_INPUT | _QS_POSTMESSAGE | _QS_TIMER | _QS_PAINT | _QS_HOTKEY
|
||||||
_QS_KEY = 0x0001
|
_QS_HOTKEY = 0x0080
|
||||||
_QS_MOUSE = _QS_MOUSEMOVE | _QS_MOUSEBUTTON
|
_QS_INPUT = _QS_MOUSE | _QS_KEY | _QS_RAWINPUT
|
||||||
_QS_MOUSEBUTTON = 0x0004
|
_QS_KEY = 0x0001
|
||||||
_QS_MOUSEMOVE = 0x0002
|
_QS_MOUSE = _QS_MOUSEMOVE | _QS_MOUSEBUTTON
|
||||||
_QS_PAINT = 0x0020
|
_QS_MOUSEBUTTON = 0x0004
|
||||||
_QS_POSTMESSAGE = 0x0008
|
_QS_MOUSEMOVE = 0x0002
|
||||||
_QS_RAWINPUT = 0x0400
|
_QS_PAINT = 0x0020
|
||||||
_QS_TIMER = 0x0010
|
_QS_POSTMESSAGE = 0x0008
|
||||||
_RID_INPUT = 0x10000003
|
_QS_RAWINPUT = 0x0400
|
||||||
_RIDEV_REMOVE = 0x00000001
|
_QS_TIMER = 0x0010
|
||||||
_SC_KEYMENU = 0xf100
|
_RID_INPUT = 0x10000003
|
||||||
_SC_MONITORPOWER = 0xf170
|
_RIDEV_REMOVE = 0x00000001
|
||||||
_SC_SCREENSAVE = 0xf140
|
_SC_KEYMENU = 0xf100
|
||||||
_SIZE_MAXIMIZED = 2
|
_SC_MONITORPOWER = 0xf170
|
||||||
_SIZE_MINIMIZED = 1
|
_SC_SCREENSAVE = 0xf140
|
||||||
_SIZE_RESTORED = 0
|
_SIZE_MAXIMIZED = 2
|
||||||
_SM_CXICON = 11
|
_SIZE_MINIMIZED = 1
|
||||||
_SM_CXSMICON = 49
|
_SIZE_RESTORED = 0
|
||||||
_SM_CYCAPTION = 4
|
_SM_CXICON = 11
|
||||||
_SM_CYICON = 12
|
_SM_CXSMICON = 49
|
||||||
_SM_CYSMICON = 50
|
_SM_CYCAPTION = 4
|
||||||
_SPI_GETFOREGROUNDLOCKTIMEOUT = 0x2000
|
_SM_CYICON = 12
|
||||||
_SPI_GETMOUSETRAILS = 94
|
_SM_CYSMICON = 50
|
||||||
_SPI_SETFOREGROUNDLOCKTIMEOUT = 0x2001
|
_SPI_GETFOREGROUNDLOCKTIMEOUT = 0x2000
|
||||||
_SPI_SETMOUSETRAILS = 93
|
_SPI_GETMOUSETRAILS = 94
|
||||||
_SPIF_SENDCHANGE = _SPIF_SENDWININICHANGE
|
_SPI_SETFOREGROUNDLOCKTIMEOUT = 0x2001
|
||||||
_SPIF_SENDWININICHANGE = 2
|
_SPI_SETMOUSETRAILS = 93
|
||||||
_SW_HIDE = 0
|
_SPIF_SENDCHANGE = _SPIF_SENDWININICHANGE
|
||||||
_SW_MAXIMIZE = _SW_SHOWMAXIMIZED
|
_SPIF_SENDWININICHANGE = 2
|
||||||
_SW_MINIMIZE = 6
|
_SW_HIDE = 0
|
||||||
_SW_RESTORE = 9
|
_SW_MAXIMIZE = _SW_SHOWMAXIMIZED
|
||||||
_SW_SHOWNA = 8
|
_SW_MINIMIZE = 6
|
||||||
_SW_SHOWMAXIMIZED = 3
|
_SW_RESTORE = 9
|
||||||
_SWP_FRAMECHANGED = 0x0020
|
_SW_SHOWNA = 8
|
||||||
_SWP_NOACTIVATE = 0x0010
|
_SW_SHOWMAXIMIZED = 3
|
||||||
_SWP_NOCOPYBITS = 0x0100
|
_SWP_FRAMECHANGED = 0x0020
|
||||||
_SWP_NOMOVE = 0x0002
|
_SWP_NOACTIVATE = 0x0010
|
||||||
_SWP_NOOWNERZORDER = 0x0200
|
_SWP_NOCOPYBITS = 0x0100
|
||||||
_SWP_NOSIZE = 0x0001
|
_SWP_NOMOVE = 0x0002
|
||||||
_SWP_NOZORDER = 0x0004
|
_SWP_NOOWNERZORDER = 0x0200
|
||||||
_SWP_SHOWWINDOW = 0x0040
|
_SWP_NOSIZE = 0x0001
|
||||||
_TLS_OUT_OF_INDEXES uint32 = 0xffffffff
|
_SWP_NOZORDER = 0x0004
|
||||||
_TME_LEAVE = 0x00000002
|
_SWP_SHOWWINDOW = 0x0040
|
||||||
_UNICODE_NOCHAR = 0xffff
|
_TLS_OUT_OF_INDEXES uint32 = 0xffffffff
|
||||||
_USER_DEFAULT_SCREEN_DPI = 96
|
_TME_LEAVE = 0x00000002
|
||||||
_VER_BUILDNUMBER = 0x00000004
|
_UNICODE_NOCHAR = 0xffff
|
||||||
_VER_GREATER_EQUAL = 3
|
_USER_DEFAULT_SCREEN_DPI = 96
|
||||||
_VER_MAJORVERSION = 0x00000002
|
_VER_BUILDNUMBER = 0x00000004
|
||||||
_VER_MINORVERSION = 0x00000001
|
_VER_GREATER_EQUAL = 3
|
||||||
_VER_SERVICEPACKMAJOR = 0x00000020
|
_VER_MAJORVERSION = 0x00000002
|
||||||
_VERTSIZE = 6
|
_VER_MINORVERSION = 0x00000001
|
||||||
_VK_ADD = 0x6B
|
_VER_SERVICEPACKMAJOR = 0x00000020
|
||||||
_VK_CAPITAL = 0x14
|
_VERTSIZE = 6
|
||||||
_VK_CONTROL = 0x11
|
_VK_ADD = 0x6B
|
||||||
_VK_DECIMAL = 0x6E
|
_VK_CAPITAL = 0x14
|
||||||
_VK_DIVIDE = 0x6F
|
_VK_CONTROL = 0x11
|
||||||
_VK_LSHIFT = 0xA0
|
_VK_DECIMAL = 0x6E
|
||||||
_VK_LWIN = 0x5B
|
_VK_DIVIDE = 0x6F
|
||||||
_VK_MENU = 0x12
|
_VK_LSHIFT = 0xA0
|
||||||
_VK_MULTIPLY = 0x6A
|
_VK_LWIN = 0x5B
|
||||||
_VK_NUMLOCK = 0x90
|
_VK_MENU = 0x12
|
||||||
_VK_NUMPAD0 = 0x60
|
_VK_MULTIPLY = 0x6A
|
||||||
_VK_NUMPAD1 = 0x61
|
_VK_NUMLOCK = 0x90
|
||||||
_VK_NUMPAD2 = 0x62
|
_VK_NUMPAD0 = 0x60
|
||||||
_VK_NUMPAD3 = 0x63
|
_VK_NUMPAD1 = 0x61
|
||||||
_VK_NUMPAD4 = 0x64
|
_VK_NUMPAD2 = 0x62
|
||||||
_VK_NUMPAD5 = 0x65
|
_VK_NUMPAD3 = 0x63
|
||||||
_VK_NUMPAD6 = 0x66
|
_VK_NUMPAD4 = 0x64
|
||||||
_VK_NUMPAD7 = 0x67
|
_VK_NUMPAD5 = 0x65
|
||||||
_VK_NUMPAD8 = 0x68
|
_VK_NUMPAD6 = 0x66
|
||||||
_VK_NUMPAD9 = 0x69
|
_VK_NUMPAD7 = 0x67
|
||||||
_VK_PROCESSKEY = 0xE5
|
_VK_NUMPAD8 = 0x68
|
||||||
_VK_RSHIFT = 0xA1
|
_VK_NUMPAD9 = 0x69
|
||||||
_VK_RWIN = 0x5C
|
_VK_PROCESSKEY = 0xE5
|
||||||
_VK_SHIFT = 0x10
|
_VK_RSHIFT = 0xA1
|
||||||
_VK_SNAPSHOT = 0x2C
|
_VK_RWIN = 0x5C
|
||||||
_VK_SUBTRACT = 0x6D
|
_VK_SHIFT = 0x10
|
||||||
_WAIT_FAILED = 0xffffffff
|
_VK_SNAPSHOT = 0x2C
|
||||||
_WHEEL_DELTA = 120
|
_VK_SUBTRACT = 0x6D
|
||||||
_WGL_ACCUM_BITS_ARB = 0x201D
|
_WAIT_FAILED = 0xffffffff
|
||||||
_WGL_ACCELERATION_ARB = 0x2003
|
_WHEEL_DELTA = 120
|
||||||
_WGL_ACCUM_ALPHA_BITS_ARB = 0x2021
|
_WGL_ACCUM_BITS_ARB = 0x201D
|
||||||
_WGL_ACCUM_BLUE_BITS_ARB = 0x2020
|
_WGL_ACCELERATION_ARB = 0x2003
|
||||||
_WGL_ACCUM_GREEN_BITS_ARB = 0x201F
|
_WGL_ACCUM_ALPHA_BITS_ARB = 0x2021
|
||||||
_WGL_ACCUM_RED_BITS_ARB = 0x201E
|
_WGL_ACCUM_BLUE_BITS_ARB = 0x2020
|
||||||
_WGL_AUX_BUFFERS_ARB = 0x2024
|
_WGL_ACCUM_GREEN_BITS_ARB = 0x201F
|
||||||
_WGL_ALPHA_BITS_ARB = 0x201B
|
_WGL_ACCUM_RED_BITS_ARB = 0x201E
|
||||||
_WGL_ALPHA_SHIFT_ARB = 0x201C
|
_WGL_AUX_BUFFERS_ARB = 0x2024
|
||||||
_WGL_BLUE_BITS_ARB = 0x2019
|
_WGL_ALPHA_BITS_ARB = 0x201B
|
||||||
_WGL_BLUE_SHIFT_ARB = 0x201A
|
_WGL_ALPHA_SHIFT_ARB = 0x201C
|
||||||
_WGL_COLOR_BITS_ARB = 0x2014
|
_WGL_BLUE_BITS_ARB = 0x2019
|
||||||
_WGL_COLORSPACE_EXT = 0x309D
|
_WGL_BLUE_SHIFT_ARB = 0x201A
|
||||||
_WGL_COLORSPACE_SRGB_EXT = 0x3089
|
_WGL_COLOR_BITS_ARB = 0x2014
|
||||||
_WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002
|
_WGL_COLORSPACE_EXT = 0x309D
|
||||||
_WGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001
|
_WGL_COLORSPACE_SRGB_EXT = 0x3089
|
||||||
_WGL_CONTEXT_DEBUG_BIT_ARB = 0x0001
|
_WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002
|
||||||
_WGL_CONTEXT_ES2_PROFILE_BIT_EXT = 0x00000004
|
_WGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001
|
||||||
_WGL_CONTEXT_FLAGS_ARB = 0x2094
|
_WGL_CONTEXT_DEBUG_BIT_ARB = 0x0001
|
||||||
_WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002
|
_WGL_CONTEXT_ES2_PROFILE_BIT_EXT = 0x00000004
|
||||||
_WGL_CONTEXT_MAJOR_VERSION_ARB = 0x2091
|
_WGL_CONTEXT_FLAGS_ARB = 0x2094
|
||||||
_WGL_CONTEXT_MINOR_VERSION_ARB = 0x2092
|
_WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002
|
||||||
_WGL_CONTEXT_OPENGL_NO_ERROR_ARB = 0x31B3
|
_WGL_CONTEXT_MAJOR_VERSION_ARB = 0x2091
|
||||||
_WGL_CONTEXT_PROFILE_MASK_ARB = 0x9126
|
_WGL_CONTEXT_MINOR_VERSION_ARB = 0x2092
|
||||||
_WGL_CONTEXT_RELEASE_BEHAVIOR_ARB = 0x2097
|
_WGL_CONTEXT_OPENGL_NO_ERROR_ARB = 0x31B3
|
||||||
_WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB = 0x0000
|
_WGL_CONTEXT_PROFILE_MASK_ARB = 0x9126
|
||||||
_WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB = 0x2098
|
_WGL_CONTEXT_RELEASE_BEHAVIOR_ARB = 0x2097
|
||||||
_WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB = 0x8256
|
_WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB = 0x0000
|
||||||
_WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB = 0x00000004
|
_WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB = 0x2098
|
||||||
_WGL_DEPTH_BITS_ARB = 0x2022
|
_WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB = 0x8256
|
||||||
_WGL_DRAW_TO_BITMAP_ARB = 0x2002
|
_WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB = 0x00000004
|
||||||
_WGL_DRAW_TO_WINDOW_ARB = 0x2001
|
_WGL_DEPTH_BITS_ARB = 0x2022
|
||||||
_WGL_DOUBLE_BUFFER_ARB = 0x2011
|
_WGL_DRAW_TO_BITMAP_ARB = 0x2002
|
||||||
_WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB = 0x20A9
|
_WGL_DRAW_TO_WINDOW_ARB = 0x2001
|
||||||
_WGL_GREEN_BITS_ARB = 0x2017
|
_WGL_DOUBLE_BUFFER_ARB = 0x2011
|
||||||
_WGL_GREEN_SHIFT_ARB = 0x2018
|
_WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB = 0x20A9
|
||||||
_WGL_LOSE_CONTEXT_ON_RESET_ARB = 0x8252
|
_WGL_GREEN_BITS_ARB = 0x2017
|
||||||
_WGL_NEED_PALETTE_ARB = 0x2004
|
_WGL_GREEN_SHIFT_ARB = 0x2018
|
||||||
_WGL_NEED_SYSTEM_PALETTE_ARB = 0x2005
|
_WGL_LOSE_CONTEXT_ON_RESET_ARB = 0x8252
|
||||||
_WGL_NO_ACCELERATION_ARB = 0x2025
|
_WGL_NEED_PALETTE_ARB = 0x2004
|
||||||
_WGL_NO_RESET_NOTIFICATION_ARB = 0x8261
|
_WGL_NEED_SYSTEM_PALETTE_ARB = 0x2005
|
||||||
_WGL_NUMBER_OVERLAYS_ARB = 0x2008
|
_WGL_NO_ACCELERATION_ARB = 0x2025
|
||||||
_WGL_NUMBER_PIXEL_FORMATS_ARB = 0x2000
|
_WGL_NO_RESET_NOTIFICATION_ARB = 0x8261
|
||||||
_WGL_NUMBER_UNDERLAYS_ARB = 0x2009
|
_WGL_NUMBER_OVERLAYS_ARB = 0x2008
|
||||||
_WGL_PIXEL_TYPE_ARB = 0x2013
|
_WGL_NUMBER_PIXEL_FORMATS_ARB = 0x2000
|
||||||
_WGL_RED_BITS_ARB = 0x2015
|
_WGL_NUMBER_UNDERLAYS_ARB = 0x2009
|
||||||
_WGL_RED_SHIFT_ARB = 0x2016
|
_WGL_PIXEL_TYPE_ARB = 0x2013
|
||||||
_WGL_SAMPLES_ARB = 0x2042
|
_WGL_RED_BITS_ARB = 0x2015
|
||||||
_WGL_SHARE_ACCUM_ARB = 0x200E
|
_WGL_RED_SHIFT_ARB = 0x2016
|
||||||
_WGL_SHARE_DEPTH_ARB = 0x200C
|
_WGL_SAMPLES_ARB = 0x2042
|
||||||
_WGL_SHARE_STENCIL_ARB = 0x200D
|
_WGL_SHARE_ACCUM_ARB = 0x200E
|
||||||
_WGL_STENCIL_BITS_ARB = 0x2023
|
_WGL_SHARE_DEPTH_ARB = 0x200C
|
||||||
_WGL_STEREO_ARB = 0x2012
|
_WGL_SHARE_STENCIL_ARB = 0x200D
|
||||||
_WGL_SUPPORT_GDI_ARB = 0x200F
|
_WGL_STENCIL_BITS_ARB = 0x2023
|
||||||
_WGL_SUPPORT_OPENGL_ARB = 0x2010
|
_WGL_STEREO_ARB = 0x2012
|
||||||
_WGL_SWAP_LAYER_BUFFERS_ARB = 0x2006
|
_WGL_SUPPORT_GDI_ARB = 0x200F
|
||||||
_WGL_SWAP_METHOD_ARB = 0x2007
|
_WGL_SUPPORT_OPENGL_ARB = 0x2010
|
||||||
_WGL_TRANSPARENT_ARB = 0x200A
|
_WGL_SWAP_LAYER_BUFFERS_ARB = 0x2006
|
||||||
_WGL_TRANSPARENT_ALPHA_VALUE_ARB = 0x203A
|
_WGL_SWAP_METHOD_ARB = 0x2007
|
||||||
_WGL_TRANSPARENT_BLUE_VALUE_ARB = 0x2039
|
_WGL_TRANSPARENT_ARB = 0x200A
|
||||||
_WGL_TRANSPARENT_GREEN_VALUE_ARB = 0x2038
|
_WGL_TRANSPARENT_ALPHA_VALUE_ARB = 0x203A
|
||||||
_WGL_TRANSPARENT_INDEX_VALUE_ARB = 0x203B
|
_WGL_TRANSPARENT_BLUE_VALUE_ARB = 0x2039
|
||||||
_WGL_TRANSPARENT_RED_VALUE_ARB = 0x2037
|
_WGL_TRANSPARENT_GREEN_VALUE_ARB = 0x2038
|
||||||
_WGL_TYPE_RGBA_ARB = 0x202B
|
_WGL_TRANSPARENT_INDEX_VALUE_ARB = 0x203B
|
||||||
_WIN32_WINNT_VISTA = 0x0600
|
_WGL_TRANSPARENT_RED_VALUE_ARB = 0x2037
|
||||||
_WIN32_WINNT_WIN7 = 0x0601
|
_WGL_TYPE_RGBA_ARB = 0x202B
|
||||||
_WIN32_WINNT_WIN8 = 0x0602
|
_WIN32_WINNT_VISTA = 0x0600
|
||||||
_WIN32_WINNT_WINBLUE = 0x0603
|
_WIN32_WINNT_WIN7 = 0x0601
|
||||||
_WIN32_WINNT_WINXP = 0x0501
|
_WIN32_WINNT_WIN8 = 0x0602
|
||||||
_WM_CAPTURECHANGED = 0x0215
|
_WIN32_WINNT_WINBLUE = 0x0603
|
||||||
_WM_CHAR = 0x0102
|
_WIN32_WINNT_WINXP = 0x0501
|
||||||
_WM_CLOSE = 0x0010
|
_WM_CAPTURECHANGED = 0x0215
|
||||||
_WM_COPYDATA = 0x004a
|
_WM_CHAR = 0x0102
|
||||||
_WM_COPYGLOBALDATA = 0x0049
|
_WM_CLOSE = 0x0010
|
||||||
_WM_DISPLAYCHANGE = 0x007e
|
_WM_COPYDATA = 0x004a
|
||||||
_WM_DPICHANGED = 0x02e0
|
_WM_COPYGLOBALDATA = 0x0049
|
||||||
_WM_DROPFILES = 0x0233
|
_WM_DISPLAYCHANGE = 0x007e
|
||||||
_WM_DWMCOMPOSITIONCHANGED = 0x031E
|
_WM_DPICHANGED = 0x02e0
|
||||||
_WM_DWMCOLORIZATIONCOLORCHANGED = 0x0320
|
_WM_DROPFILES = 0x0233
|
||||||
_WM_ENTERMENULOOP = 0x0211
|
_WM_DWMCOMPOSITIONCHANGED = 0x031E
|
||||||
_WM_ENTERSIZEMOVE = 0x0231
|
_WM_DWMCOLORIZATIONCOLORCHANGED = 0x0320
|
||||||
_WM_ERASEBKGND = 0x0014
|
_WM_ENTERMENULOOP = 0x0211
|
||||||
_WM_EXITMENULOOP = 0x0212
|
_WM_ENTERSIZEMOVE = 0x0231
|
||||||
_WM_EXITSIZEMOVE = 0x0232
|
_WM_ERASEBKGND = 0x0014
|
||||||
_WM_GETDPISCALEDSIZE = 0x02e4
|
_WM_EXITMENULOOP = 0x0212
|
||||||
_WM_GETMINMAXINFO = 0x0024
|
_WM_EXITSIZEMOVE = 0x0232
|
||||||
_WM_INPUT = 0x00ff
|
_WM_GETDPISCALEDSIZE = 0x02e4
|
||||||
_WM_INPUTLANGCHANGE = 0x0051
|
_WM_GETMINMAXINFO = 0x0024
|
||||||
_WM_KEYDOWN = _WM_KEYFIRST
|
_WM_INPUT = 0x00ff
|
||||||
_WM_KEYFIRST = 0x0100
|
_WM_INPUTLANGCHANGE = 0x0051
|
||||||
_WM_KEYUP = 0x0101
|
_WM_KEYDOWN = _WM_KEYFIRST
|
||||||
_WM_KILLFOCUS = 0x0008
|
_WM_KEYFIRST = 0x0100
|
||||||
_WM_LBUTTONDOWN = 0x0201
|
_WM_KEYUP = 0x0101
|
||||||
_WM_LBUTTONUP = 0x0202
|
_WM_KILLFOCUS = 0x0008
|
||||||
_WM_MBUTTONDOWN = 0x0207
|
_WM_LBUTTONDOWN = 0x0201
|
||||||
_WM_MBUTTONUP = 0x0208
|
_WM_LBUTTONUP = 0x0202
|
||||||
_WM_NCACTIVATE = 0x0086
|
_WM_MBUTTONDOWN = 0x0207
|
||||||
_WM_NCPAINT = 0x0085
|
_WM_MBUTTONUP = 0x0208
|
||||||
_WM_NULL = 0x0000
|
_WM_NCACTIVATE = 0x0086
|
||||||
_WM_MOUSEACTIVATE = 0x0021
|
_WM_NCPAINT = 0x0085
|
||||||
_WM_MOUSEFIRST = 0x0200
|
_WM_NULL = 0x0000
|
||||||
_WM_MOUSEHWHEEL = 0x020E
|
_WM_MOUSEACTIVATE = 0x0021
|
||||||
_WM_MOUSELEAVE = 0x02A3
|
_WM_MOUSEFIRST = 0x0200
|
||||||
_WM_MOUSEMOVE = _WM_MOUSEFIRST
|
_WM_MOUSEHWHEEL = 0x020E
|
||||||
_WM_MOUSEWHEEL = 0x020A
|
_WM_MOUSELEAVE = 0x02A3
|
||||||
_WM_MOVE = 0x0003
|
_WM_MOUSEMOVE = _WM_MOUSEFIRST
|
||||||
_WM_NCCREATE = 0x0081
|
_WM_MOUSEWHEEL = 0x020A
|
||||||
_WM_PAINT = 0x000f
|
_WM_MOVE = 0x0003
|
||||||
_WM_QUIT = 0x0012
|
_WM_NCCREATE = 0x0081
|
||||||
_WM_RBUTTONDOWN = 0x0204
|
_WM_PAINT = 0x000f
|
||||||
_WM_RBUTTONUP = 0x0205
|
_WM_QUIT = 0x0012
|
||||||
_WM_SETCURSOR = 0x0020
|
_WM_RBUTTONDOWN = 0x0204
|
||||||
_WM_SETFOCUS = 0x0007
|
_WM_RBUTTONUP = 0x0205
|
||||||
_WM_SETICON = 0x0080
|
_WM_SETCURSOR = 0x0020
|
||||||
_WM_SIZE = 0x0005
|
_WM_SETFOCUS = 0x0007
|
||||||
_WM_SIZING = 0x0214
|
_WM_SETICON = 0x0080
|
||||||
_WM_SYSCHAR = 0x0106
|
_WM_SIZE = 0x0005
|
||||||
_WM_SYSCOMMAND = 0x0112
|
_WM_SIZING = 0x0214
|
||||||
_WM_SYSKEYDOWN = 0x0104
|
_WM_SYSCHAR = 0x0106
|
||||||
_WM_SYSKEYUP = 0x0105
|
_WM_SYSCOMMAND = 0x0112
|
||||||
_WM_UNICHAR = 0x0109
|
_WM_SYSKEYDOWN = 0x0104
|
||||||
_WM_XBUTTONDOWN = 0x020B
|
_WM_SYSKEYUP = 0x0105
|
||||||
_WM_XBUTTONUP = 0x020C
|
_WM_UNICHAR = 0x0109
|
||||||
_WMSZ_BOTTOM = 6
|
_WM_XBUTTONDOWN = 0x020B
|
||||||
_WMSZ_BOTTOMLEFT = 7
|
_WM_XBUTTONUP = 0x020C
|
||||||
_WMSZ_BOTTOMRIGHT = 8
|
_WMSZ_BOTTOM = 6
|
||||||
_WMSZ_LEFT = 1
|
_WMSZ_BOTTOMLEFT = 7
|
||||||
_WMSZ_RIGHT = 2
|
_WMSZ_BOTTOMRIGHT = 8
|
||||||
_WMSZ_TOP = 3
|
_WMSZ_LEFT = 1
|
||||||
_WMSZ_TOPLEFT = 4
|
_WMSZ_RIGHT = 2
|
||||||
_WMSZ_TOPRIGHT = 5
|
_WMSZ_TOP = 3
|
||||||
_WS_BORDER = 0x00800000
|
_WMSZ_TOPLEFT = 4
|
||||||
_WS_CAPTION = _WS_BORDER | _WS_DLGFRAME
|
_WMSZ_TOPRIGHT = 5
|
||||||
_WS_CLIPSIBLINGS = 0x04000000
|
_WS_BORDER = 0x00800000
|
||||||
_WS_CLIPCHILDREN = 0x02000000
|
_WS_CAPTION = _WS_BORDER | _WS_DLGFRAME
|
||||||
_WS_DLGFRAME = 0x00400000
|
_WS_CLIPSIBLINGS = 0x04000000
|
||||||
_WS_EX_APPWINDOW = 0x00040000
|
_WS_CLIPCHILDREN = 0x02000000
|
||||||
_WS_EX_CLIENTEDGE = 0x00000200
|
_WS_DLGFRAME = 0x00400000
|
||||||
_WS_EX_LAYERED = 0x00080000
|
_WS_EX_APPWINDOW = 0x00040000
|
||||||
_WS_EX_OVERLAPPEDWINDOW = _WS_EX_WINDOWEDGE | _WS_EX_CLIENTEDGE
|
_WS_EX_CLIENTEDGE = 0x00000200
|
||||||
_WS_EX_TOPMOST = 0x00000008
|
_WS_EX_LAYERED = 0x00080000
|
||||||
_WS_EX_WINDOWEDGE = 0x00000100
|
_WS_EX_OVERLAPPEDWINDOW = _WS_EX_WINDOWEDGE | _WS_EX_CLIENTEDGE
|
||||||
_WS_MAXIMIZE = 0x01000000
|
_WS_EX_TOPMOST = 0x00000008
|
||||||
_WS_MAXIMIZEBOX = 0x00010000
|
_WS_EX_WINDOWEDGE = 0x00000100
|
||||||
_WS_MINIMIZEBOX = 0x00020000
|
_WS_MAXIMIZE = 0x01000000
|
||||||
_WS_OVERLAPPED = 0x00000000
|
_WS_MAXIMIZEBOX = 0x00010000
|
||||||
_WS_OVERLAPPEDWINDOW = _WS_OVERLAPPED | _WS_CAPTION | _WS_SYSMENU | _WS_THICKFRAME | _WS_MINIMIZEBOX | _WS_MAXIMIZEBOX
|
_WS_MINIMIZEBOX = 0x00020000
|
||||||
_WS_POPUP = 0x80000000
|
_WS_OVERLAPPED = 0x00000000
|
||||||
_WS_SYSMENU = 0x00080000
|
_WS_OVERLAPPEDWINDOW = _WS_OVERLAPPED | _WS_CAPTION | _WS_SYSMENU | _WS_THICKFRAME | _WS_MINIMIZEBOX | _WS_MAXIMIZEBOX
|
||||||
_WS_THICKFRAME = 0x00040000
|
_WS_POPUP = 0x80000000
|
||||||
_XBUTTON1 = 0x0001
|
_WS_SYSMENU = 0x00080000
|
||||||
|
_WS_THICKFRAME = 0x00040000
|
||||||
|
_XBUTTON1 = 0x0001
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@ -735,7 +737,7 @@ var (
|
|||||||
procSetPixelFormat = gdi32.NewProc("SetPixelFormat")
|
procSetPixelFormat = gdi32.NewProc("SetPixelFormat")
|
||||||
procSwapBuffers = gdi32.NewProc("SwapBuffers")
|
procSwapBuffers = gdi32.NewProc("SwapBuffers")
|
||||||
|
|
||||||
procGetModuleHandleW = kernel32.NewProc("GetModuleHandleW")
|
procGetModuleHandleExW = kernel32.NewProc("GetModuleHandleExW")
|
||||||
procSetThreadExecutionState = kernel32.NewProc("SetThreadExecutionState")
|
procSetThreadExecutionState = kernel32.NewProc("SetThreadExecutionState")
|
||||||
procTlsAlloc = kernel32.NewProc("TlsAlloc")
|
procTlsAlloc = kernel32.NewProc("TlsAlloc")
|
||||||
procTlsFree = kernel32.NewProc("TlsFree")
|
procTlsFree = kernel32.NewProc("TlsFree")
|
||||||
@ -1260,23 +1262,31 @@ func _GetMessageTime() int32 {
|
|||||||
return int32(r)
|
return int32(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _GetModuleHandleW(moduleName string) (_HMODULE, error) {
|
func _GetModuleHandleExW(dwFlags uint32, lpModuleName interface{}) (_HMODULE, error) {
|
||||||
var lpModuleName *uint16
|
var ptr unsafe.Pointer
|
||||||
if moduleName != "" {
|
switch moduleName := lpModuleName.(type) {
|
||||||
var err error
|
case string:
|
||||||
lpModuleName, err = windows.UTF16PtrFromString(moduleName)
|
if moduleName != "" {
|
||||||
if err != nil {
|
p, err := windows.UTF16PtrFromString(moduleName)
|
||||||
panic("glfwwin: module name must not include a NUL character")
|
if err != nil {
|
||||||
|
panic("glfwwin: module name must not include a NUL character")
|
||||||
|
}
|
||||||
|
ptr = unsafe.Pointer(p)
|
||||||
}
|
}
|
||||||
|
case unsafe.Pointer:
|
||||||
|
ptr = moduleName
|
||||||
|
default:
|
||||||
|
return 0, fmt.Errorf("glfwwin: GetModuleHandleExW: lpModuleName must be a string or an unsafe.Pointer but %T", moduleName)
|
||||||
}
|
}
|
||||||
|
|
||||||
r, _, e := procGetModuleHandleW.Call(uintptr(unsafe.Pointer(lpModuleName)))
|
var module _HMODULE
|
||||||
runtime.KeepAlive(lpModuleName)
|
r, _, e := procGetModuleHandleExW.Call(uintptr(dwFlags), uintptr(ptr), uintptr(unsafe.Pointer(&module)))
|
||||||
|
runtime.KeepAlive(ptr)
|
||||||
|
|
||||||
if _HMODULE(r) == 0 {
|
if int32(r) != 1 {
|
||||||
return 0, fmt.Errorf("glfwwin: GetModuleHandleW failed: %w", e)
|
return 0, fmt.Errorf("glfwwin: GetModuleHandleExW failed: %w", e)
|
||||||
}
|
}
|
||||||
return _HMODULE(r), nil
|
return module, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func _GetMonitorInfoW(hMonitor _HMONITOR) (_MONITORINFO, bool) {
|
func _GetMonitorInfoW(hMonitor _HMONITOR) (_MONITORINFO, bool) {
|
||||||
|
@ -254,6 +254,7 @@ type library struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
win32 struct {
|
win32 struct {
|
||||||
|
instance _HINSTANCE
|
||||||
helperWindowHandle windows.HWND
|
helperWindowHandle windows.HWND
|
||||||
deviceNotificationHandle _HDEVNOTIFY
|
deviceNotificationHandle _HDEVNOTIFY
|
||||||
acquiredMonitorCount int
|
acquiredMonitorCount int
|
||||||
|
@ -83,7 +83,6 @@ func createKeyTables() {
|
|||||||
_glfw.win32.keycodes[0x151] = KeyPageDown
|
_glfw.win32.keycodes[0x151] = KeyPageDown
|
||||||
_glfw.win32.keycodes[0x149] = KeyPageUp
|
_glfw.win32.keycodes[0x149] = KeyPageUp
|
||||||
_glfw.win32.keycodes[0x045] = KeyPause
|
_glfw.win32.keycodes[0x045] = KeyPause
|
||||||
_glfw.win32.keycodes[0x146] = KeyPause
|
|
||||||
_glfw.win32.keycodes[0x039] = KeySpace
|
_glfw.win32.keycodes[0x039] = KeySpace
|
||||||
_glfw.win32.keycodes[0x00F] = KeyTab
|
_glfw.win32.keycodes[0x00F] = KeyTab
|
||||||
_glfw.win32.keycodes[0x03A] = KeyCapsLock
|
_glfw.win32.keycodes[0x03A] = KeyCapsLock
|
||||||
@ -153,12 +152,7 @@ func createKeyTables() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createHelperWindow() error {
|
func createHelperWindow() error {
|
||||||
m, err := _GetModuleHandleW("")
|
h, err := _CreateWindowExW(_WS_EX_OVERLAPPEDWINDOW, _GLFW_WNDCLASSNAME, "GLFW message window", _WS_CLIPSIBLINGS|_WS_CLIPCHILDREN, 0, 0, 1, 1, 0, 0, _glfw.win32.instance, nil)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
h, err := _CreateWindowExW(_WS_EX_OVERLAPPEDWINDOW, _GLFW_WNDCLASSNAME, "GLFW message window", _WS_CLIPSIBLINGS|_WS_CLIPCHILDREN, 0, 0, 1, 1, 0, 0, _HINSTANCE(m), nil)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -237,6 +231,12 @@ func platformInit() error {
|
|||||||
// Changing the foreground lock timeout was removed from the original code.
|
// Changing the foreground lock timeout was removed from the original code.
|
||||||
// See https://github.com/glfw/glfw/commit/58b48a3a00d9c2a5ca10cc23069a71d8773cc7a4
|
// See https://github.com/glfw/glfw/commit/58b48a3a00d9c2a5ca10cc23069a71d8773cc7a4
|
||||||
|
|
||||||
|
m, err := _GetModuleHandleExW(_GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS|_GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, unsafe.Pointer(&_glfw))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_glfw.win32.instance = _HINSTANCE(m)
|
||||||
|
|
||||||
createKeyTables()
|
createKeyTables()
|
||||||
|
|
||||||
if isWindows10CreatorsUpdateOrGreaterWin32() {
|
if isWindows10CreatorsUpdateOrGreaterWin32() {
|
||||||
|
@ -738,6 +738,21 @@ func windowProc(hWnd windows.HWND, uMsg uint32, wParam _WPARAM, lParam _LPARAM)
|
|||||||
scancode = _MapVirtualKeyW(uint32(wParam), _MAPVK_VK_TO_VSC)
|
scancode = _MapVirtualKeyW(uint32(wParam), _MAPVK_VK_TO_VSC)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK: Alt+PrtSc has a different scancode than just PrtSc
|
||||||
|
if scancode == 0x54 {
|
||||||
|
scancode = 0x137
|
||||||
|
}
|
||||||
|
|
||||||
|
// HACK: Ctrl+Pause has a different scancode than just Pause
|
||||||
|
if scancode == 0x146 {
|
||||||
|
scancode = 0x45
|
||||||
|
}
|
||||||
|
|
||||||
|
// HACK: CJK IME sets the extended bit for right Shift
|
||||||
|
if scancode == 0x136 {
|
||||||
|
scancode = 0x36
|
||||||
|
}
|
||||||
|
|
||||||
key := _glfw.win32.keycodes[scancode]
|
key := _glfw.win32.keycodes[scancode]
|
||||||
|
|
||||||
// The Ctrl keys require special handling
|
// The Ctrl keys require special handling
|
||||||
@ -1186,15 +1201,17 @@ func (w *Window) createNativeWindow(wndconfig *wndconfig, fbconfig *fbconfig) er
|
|||||||
|
|
||||||
var xpos, ypos, fullWidth, fullHeight int32
|
var xpos, ypos, fullWidth, fullHeight int32
|
||||||
if w.monitor != nil {
|
if w.monitor != nil {
|
||||||
|
mi, ok := _GetMonitorInfoW(w.monitor.win32.handle)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("glfwwin: GetMonitorInfoW failed")
|
||||||
|
}
|
||||||
// NOTE: This window placement is temporary and approximate, as the
|
// NOTE: This window placement is temporary and approximate, as the
|
||||||
// correct position and size cannot be known until the monitor
|
// correct position and size cannot be known until the monitor
|
||||||
// video mode has been picked in _glfwSetVideoModeWin32
|
// video mode has been picked in _glfwSetVideoModeWin32
|
||||||
x, y, _ := w.monitor.platformGetMonitorPos()
|
xpos = mi.rcMonitor.left
|
||||||
xpos, ypos = int32(x), int32(y)
|
ypos = mi.rcMonitor.top
|
||||||
|
fullWidth = mi.rcMonitor.right - mi.rcMonitor.left
|
||||||
mode := w.monitor.platformGetVideoMode()
|
fullHeight = mi.rcMonitor.bottom - mi.rcMonitor.top
|
||||||
fullWidth = int32(mode.Width)
|
|
||||||
fullHeight = int32(mode.Height)
|
|
||||||
} else {
|
} else {
|
||||||
xpos = _CW_USEDEFAULT
|
xpos = _CW_USEDEFAULT
|
||||||
ypos = _CW_USEDEFAULT
|
ypos = _CW_USEDEFAULT
|
||||||
@ -1211,15 +1228,10 @@ func (w *Window) createNativeWindow(wndconfig *wndconfig, fbconfig *fbconfig) er
|
|||||||
fullWidth, fullHeight = int32(w), int32(h)
|
fullWidth, fullHeight = int32(w), int32(h)
|
||||||
}
|
}
|
||||||
|
|
||||||
m, err := _GetModuleHandleW("")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
h, err := _CreateWindowExW(exStyle, _GLFW_WNDCLASSNAME, wndconfig.title, style, xpos, ypos, fullWidth, fullHeight,
|
h, err := _CreateWindowExW(exStyle, _GLFW_WNDCLASSNAME, wndconfig.title, style, xpos, ypos, fullWidth, fullHeight,
|
||||||
0, // No parent window
|
0, // No parent window
|
||||||
0, // No window menu
|
0, // No window menu
|
||||||
_HINSTANCE(m), unsafe.Pointer(wndconfig))
|
_glfw.win32.instance, unsafe.Pointer(wndconfig))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1335,11 +1347,7 @@ func registerWindowClassWin32() error {
|
|||||||
wc.cbSize = uint32(unsafe.Sizeof(wc))
|
wc.cbSize = uint32(unsafe.Sizeof(wc))
|
||||||
wc.style = _CS_HREDRAW | _CS_VREDRAW | _CS_OWNDC
|
wc.style = _CS_HREDRAW | _CS_VREDRAW | _CS_OWNDC
|
||||||
wc.lpfnWndProc = _WNDPROC(windowProcPtr)
|
wc.lpfnWndProc = _WNDPROC(windowProcPtr)
|
||||||
module, err := _GetModuleHandleW("")
|
wc.hInstance = _glfw.win32.instance
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
wc.hInstance = _HINSTANCE(module)
|
|
||||||
cursor, err := _LoadCursorW(0, _IDC_ARROW)
|
cursor, err := _LoadCursorW(0, _IDC_ARROW)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1370,11 +1378,7 @@ func registerWindowClassWin32() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func unregisterWindowClassWin32() error {
|
func unregisterWindowClassWin32() error {
|
||||||
m, err := _GetModuleHandleW("")
|
if err := _UnregisterClassW(_GLFW_WNDCLASSNAME, _glfw.win32.instance); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := _UnregisterClassW(_GLFW_WNDCLASSNAME, _HINSTANCE(m)); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -1394,6 +1398,9 @@ func (w *Window) platformCreateWindow(wndconfig *wndconfig, ctxconfig *ctxconfig
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if err := w.refreshContextAttribs(ctxconfig); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if w.monitor != nil {
|
if w.monitor != nil {
|
||||||
@ -1407,6 +1414,20 @@ func (w *Window) platformCreateWindow(wndconfig *wndconfig, ctxconfig *ctxconfig
|
|||||||
if err := w.fitToMonitor(); err != nil {
|
if err := w.fitToMonitor(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if wndconfig.centerCursor {
|
||||||
|
if err := w.centerCursorInContentArea(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if wndconfig.visible {
|
||||||
|
w.platformShowWindow()
|
||||||
|
if wndconfig.focused {
|
||||||
|
if err := w.platformFocusWindow(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -146,29 +146,6 @@ func CreateWindow(width, height int, title string, monitor *Monitor, share *Wind
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctxconfig.client != NoAPI {
|
|
||||||
if err := window.refreshContextAttribs(&ctxconfig); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if window.monitor != nil {
|
|
||||||
if wndconfig.centerCursor {
|
|
||||||
if err := window.centerCursorInContentArea(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if wndconfig.visible {
|
|
||||||
window.platformShowWindow()
|
|
||||||
if wndconfig.focused {
|
|
||||||
if err := window.platformFocusWindow(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return window, nil
|
return window, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user