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