Commit graph

3549 commits

Author SHA1 Message Date
thefiddler 10939fcaec [OpenTK] Add On* methods to raise events 2014-05-02 09:37:25 +02:00
thefiddler 24b19d2487 [Input] Added internal MouseDevice.Position getter 2014-05-02 09:37:25 +02:00
thefiddler f2eca2924f [Mac] Inherit from NativeWindowBase
This reduces code duplication significantly.
2014-05-02 09:37:25 +02:00
thefiddler 5ba1bf89f1 [OpenTK] Added NativeWindowBase
This acts as a common base class to INativeWindow implementations and
can be used to reduce code duplication.
2014-05-02 09:34:14 +02:00
thefiddler 9ee728d4fc [Win] Only set MouseCursor in client area
This is required according to the windows documentation.
2014-05-01 16:49:23 +02:00
thefiddler 9988a2ba9c [SDL][Win] Destroy custom cursor on Close()
X11 destroys the cursor after setting it and Cocoa uses an autorelease
pool, so that should not be necessary there.
2014-05-01 14:27:20 +02:00
thefiddler c8c0d32fcc [OpenTK] Rearranged MouseCursor parameters
MouseCursor and WindowIcon now match GL.TexImage2D in the way they
arrange their parameters. The expected values of each parameter are now
documented.
2014-04-30 20:04:31 +02:00
thefiddler 8568e6dc70 [SDL] Fixed MouseCursor getting stuck after multiple changes 2014-04-30 13:46:44 +02:00
thefiddler a5ddc530c2 [SDL] Fixed custom MouseCursor 2014-04-30 13:36:16 +02:00
thefiddler e63970e2be [Mac] Fixed cursor byte order 2014-04-30 09:06:18 +02:00
thefiddler 2632661d8a [OpenTK] Fixed compilation error 2014-04-30 08:45:27 +02:00
thefiddler 965c8baa7f [OpenTK] Renamed x/y to hotx/hoty
The new name matches their functionality closer.
2014-04-30 08:44:48 +02:00
thefiddler 890805f2ae [Platform] Renamed MouseCursor.Rgba to Argb
This matches the default format of System.Drawing.Bitmap.
2014-04-30 08:38:57 +02:00
thefiddler 7d8f14baa7 [Mac] Implement NSCursor rectangles 2014-04-30 08:38:19 +02:00
thefiddler d013ef1868 [Platform] Make MouseCursor actor public 2014-04-30 08:37:34 +02:00
thefiddler 0ed1e8b6d8 [Win] Log wglSwapIntervalEXT errors
Note that we cannot use Marshal.GetLastWin32Error because we are not
using regular DllImports for WGL extensions.
2014-04-29 08:48:49 +02:00
thefiddler f2dc40abdd [OpenTK] Query the driver for VSyncMode getter
Otherwise, the user could call Context.SwapInterval directly, causing
the vsync property to fall out of sync.
2014-04-29 08:31:47 +02:00
thefiddler 3da459b316 [All] Fixed checks for EXT_swap_control_tear
EGL and NSOpenGL do not offer an EXT_swap_control_tear equivalent so
use regular vsync for now. The relevant extension string is now
correctly checked on WGL and GLX.
2014-04-29 08:10:18 +02:00
thefiddler ab6b3c211c [Mac] Removed unused CarbonGLNative.cs 2014-04-28 17:17:34 +02:00
thefiddler 88a60b14c5 [Mac] Remove call to NewEventHandlerUPP
NewEventHandlerUPP fails to load when running through MonoKickstart. It
appears that this function is only used for old PPC systems that had
trouble with function pointers - sample code online indicates that we
do not need to call this.
2014-04-28 16:25:23 +02:00
thefiddler cf3a30d024 [Mac] CGDisplayBounds signature now matches Mac ABI
This resolves a crash in CGDisplayBounds when running through monokick.
2014-04-28 16:25:10 +02:00
thefiddler ffb7bd8a4c Merge branch 'pr/105' into develop 2014-04-28 16:19:17 +02:00
thefiddler 53d2c8d1e8 [Mac] Cmd-Q should raise Closing events
It should also be cancelable.
2014-04-28 16:19:04 +02:00
thefiddler 509f356ed4 [Win] Fixed MouseCursor.Default
It is now possible to switch from a custom cursor back to
MouseCursor.Default.
2014-04-28 09:37:16 +02:00
thefiddler 4f9a2f78d6 Merge branch 'cursor' of https://github.com/thefiddler/opentk into thefiddler-cursor 2014-04-28 07:07:47 +02:00
thefiddler 0f920fb205 [X11] Fixed SGI_swap_control query
GLX can return valid function pointer to unsupported functions.
We need to check for extension support in addition to the
function pointer.

Fixes crash on OpenSUSE 13.1 in VirtualBox.
2014-04-28 01:29:34 +02:00
thefiddler 168713aecf [GL] Added GetPName.Max*ImageUniforms
These tokens were introduced in OpenGL 4.2 and 4.3.
2014-04-27 22:47:04 +02:00
thefiddler c40115e223 [OpenTK] Only init X11 if SDL2 is not used 2014-04-27 22:41:24 +02:00
thefiddler 96b7419d83 [X11] Fixed INativeWindow.Cursor getter 2014-04-27 22:28:10 +02:00
thefiddler d03e9d82dc [Input] Fixed key modifiers in KeyboardDevice events 2014-04-27 22:27:18 +02:00
thefiddler d787656328 [SDL] Fixed cursor support
SDL.CreateColorCursor takes 3 arguments, not 5.
2014-04-27 21:09:51 +02:00
thefiddler 48e21328c5 [Mac] Implement INativeWindow.Cursor 2014-04-27 19:45:20 +02:00
thefiddler 283a785703 [OpenTK] Treat null as MouseCursor.Empty 2014-04-27 19:45:08 +02:00
thefiddler 1d8ef7165f [OpenTK] Disable custom MouseCursors
They require further development, due to byte-order differences between
platforms.

MouseCursor is now derived from WindowIcon, which we will use for
INativeWindow.Icon support in the future, in order to remove the
dependency to System.Drawing.
2014-04-27 19:44:45 +02:00
thefiddler a61d20d2eb [Mac] Stubbed INativeWindow.Cursor 2014-04-27 10:56:08 +02:00
Fraser Waters 2207144aec Fix a bug in X11 CursorVisble with custom cursors.
CursorVisible reset to the default cursor when showing the cursor, it
should instead show the custom cursor if it's defined (else the default
cursor).
2014-04-27 10:53:34 +02:00
Fraser Waters 9ed32e4445 Change bool to IntPtr.
WindowProc returns an IntPtr not a bool, so let Handle* functions return
IntPtr?. If they return a value we return that, if they return null we
call DefWindowProc and return the result from that.
2014-04-27 10:53:34 +02:00
Fraser Waters 9239fd08e3 Custom cursors on X11. 2014-04-27 10:53:33 +02:00
Fraser Waters 6e23a55f35 Add XcursorImageLoadCursor function. 2014-04-27 10:53:33 +02:00
Fraser Waters 4f2658ab79 Make xcursor fields public. 2014-04-27 10:53:33 +02:00
Fraser Waters cb5f354ddc Change xcursor library name. 2014-04-27 10:53:33 +02:00
Fraser Waters cf43b6003c Create and Destroy functions for XcursorImage. 2014-04-27 10:53:33 +02:00
Fraser Waters 52043d5f74 Xcursor types. 2014-04-27 10:53:33 +02:00
Fraser 10112da976 Respond to WM_SETCURSOR messages.
Calling SetCursor on mouse moves is not enough, we need to respond to
SETCURSOR messages. If we have a custom cursor we need to call SetCursor
and then NOT call DefWindowProc, otherwise we just call DefWindowProc
for the forms default cursor.
2014-04-27 10:53:33 +02:00
Fraser 8f9311ec8d Partial implementation of Windows MouseCursor.
Very buggy, but starting to show results.
2014-04-27 10:53:32 +02:00
Fraser b005b6e542 DestroyIcon function. 2014-04-27 10:53:32 +02:00
Fraser 4fb7a2d5c2 GetCursor function. 2014-04-27 10:53:32 +02:00
Fraser acf47f1ff4 SetCursor function. 2014-04-27 10:53:32 +02:00
Fraser dd75466239 GetIconInfo function. 2014-04-27 10:52:53 +02:00
Fraser f10d8568cb CreateIconIndirect function. 2014-04-27 10:52:53 +02:00
Fraser 6c65e2cdd3 IconInfo structure. 2014-04-27 10:52:53 +02:00
thefiddler dd55cea489 [All] Initial implementation of INativeWindow.Cursor property
Affects issue #9
2014-04-27 10:52:53 +02:00
thefiddler f545bd512b [SDL2] Implemented cursor APIs
Affects issue #9
2014-04-27 10:52:53 +02:00
thefiddler a6f610dd0c [Core] Added MouseCursor class
This branch marks the beginning of hardware cursor support (affects
issue #9)
2014-04-27 10:52:53 +02:00
Olle Håkansson 160e6ecb31 Added Quit menu item + shortcut (Cmd+Q). 2014-04-27 10:52:28 +02:00
Olle Håkansson a24ce9ba11 Fixed creating contexts without native windows.
To create a context for the GTK GLWidget, you need to be able to
specify the exact NSView you want the OpenGL context to apply to. Also,
you don’t want to initialise the NSApplication in this situation, which
the CocoaContext did before (unintentionally).
2014-04-27 09:58:05 +02:00
thefiddler 6186373df1 [ES][GL] Synced with April Khronos specification 2014-04-27 09:53:22 +02:00
thefiddler a79086bb20 [X11] Set WM_CLASS property
This allows Ubuntu Unity and Gnome Shell to detect and display
the correct application name.
2014-04-26 20:27:00 +02:00
thefiddler 78a6993cec [GL] Only print debug info in debug mode 2014-04-26 19:13:03 +02:00
thefiddler 7c4bdab110 [GL] Removed unused code 2014-04-26 19:12:49 +02:00
thefiddler cd25d5f307 [OpenTK] Removed reflection binding loading
This code is no longer in use.
2014-04-26 18:28:51 +02:00
thefiddler 95f73310d8 [X11] Implemented new-style bindings for GLX
Replaced delegates with call instructions and completely removed the
old extension loading code.
2014-04-26 18:24:13 +02:00
thefiddler 44526229be [Win] Fixed warnings
Protected object in static class and wrong parameter names in
documentation
2014-04-26 18:22:50 +02:00
thefiddler 8558509379 [GL][ES] Regenerated bindings 2014-04-26 14:23:52 +02:00
thefiddler 1666eb670c [GL][ES] Do not break public API
Even if that API is not meant to be used by applications.
2014-04-26 14:23:29 +02:00
thefiddler b732e377c9 [Mac] Sped up extension loading
From ~200ms down to ~65ms on a rMBP with Nvidia 650M and Mac OS X
10.9.2.
2014-04-26 14:21:26 +02:00
thefiddler 433fa35f7e [Graphics] GetAddress(string) is no longer needed 2014-04-26 14:20:17 +02:00
thefiddler fbeac9c323 [Graphics] Redirect GetAddress(string)
GetAddress(string) now calls GetAddress(IntPtr) internally. This
reduces the number of APIs that must be implemented for each platform.
2014-04-26 14:19:19 +02:00
thefiddler 9605940661 [X11] Optimized XKey translation 2014-04-25 21:55:00 +02:00
thefiddler 6257858d54 [Bind][ES][GL] Output entry points as byte[]
Moving from string[] to byte[] reduces startup memory allocations
tremendously (up to 70% lower memory use on Windows!)
2014-04-25 17:25:20 +02:00
thefiddler c1f284f101 [Win] Wgl no longer inherits GraphicsBindingsBase
This is a necessary step for the next commit.
2014-04-25 17:23:06 +02:00
thefiddler e433aad4b4 [ES] ES10 does not require initialization
It consists solely of DllImports that will be initialized on first use,
regardless of the existence of an OpenGL context.
2014-04-25 14:50:55 +02:00
thefiddler 3658fac263 [Input] Use Key.LastKey instead of Enum.GetValues
This avoids unnecessary memory allocations in the KeyboardDevice
constructor.
2014-04-25 14:15:06 +02:00
thefiddler 58e41a2b97 [Win] Replaced KeyMap dictionary with switch
This reduces the amount of allocations on the startup path.
2014-04-25 14:13:55 +02:00
thefiddler e36a0d0fbc [OpenTK] Rebased on develop 2014-04-25 13:38:53 +02:00
thefiddler 6994a13770 [OpenTK] Fixed DllImport library for OpenGL on Mac OS X 2014-04-25 12:14:28 +02:00
thefiddler 03a8a6da0e [SDL2] Optimized Sdl2KeyCode translation
Also fixed Key.WinLeft, WinRight and Menu translation.
2014-04-25 12:14:27 +02:00
thefiddler 9f39aa1b88 [Mac] Optimized MacOSKeyCode translation
This also reduces memory allocations on startup by ~10K.
2014-04-25 12:14:26 +02:00
thefiddler 4ae65c86ff [GL] Added missing GetPName.MaxPatchVertices 2014-04-25 11:11:42 +02:00
thefiddler 824f238973 [Mac] Removed most legacy Carbon code 2014-04-24 13:48:26 +02:00
thefiddler 5f44f3d491 [Mac] Removed unused Carbon APIs 2014-04-24 13:48:26 +02:00
thefiddler cdd88e6f7e [Mac] Migrated AglContext to OpenTK.GLControl 2014-04-24 13:48:26 +02:00
thefiddler 3475582c30 [Mac] Mouse coordinates are reported in pixels 2014-04-24 13:47:30 +02:00
thefiddler e0848f9d6d [Mac] SendFloat should use _fpret on i386 2014-04-24 13:47:30 +02:00
thefiddler 3250cbbc91 [Mac] Use scrollFactor variable 2014-04-24 13:47:30 +02:00
thefiddler a2212f0184 [Mac] Fixed a warning related to volatile UniqueId
Also changed the class name to OpenTK_GameWindow
2014-04-24 13:47:30 +02:00
thefiddler acb7dd27a7 [Mac] Window should be invisible on startup
Also fixes the initial position of the window.
2014-04-24 13:47:30 +02:00
Olle Håkansson 64fb043b77 Licensed files under MIT/X11. 2014-04-24 13:45:06 +02:00
thefiddler b0eedc122d [Mac] Avoid class conflicts for multiple windows
When creating multiple windows, their classes must have different class
names or they will fail to construct.

This commit ensures their names are unique. It also fixes a potential
memory leak in the Icon setter.
2014-04-24 13:45:06 +02:00
thefiddler 287c2b3415 [Mac] Add CocoaContext.GetGraphicsMode via CGL
Once the context is constructed, we use GetGraphicsMode to retrieve the
exact GraphicsMode that was selected by CocoaContext.
2014-04-24 13:45:06 +02:00
Olle Håkansson 2943bdfecb Fixed too high mouse scrolling speed. 2014-04-24 13:45:06 +02:00
Olle Håkansson 4573db2ceb Much improved handling of window/border states. 2014-04-24 13:45:06 +02:00
Olle Håkansson df6caa3cbb Fixed missing Mode value in CocoaContext.
Crashed E.g. GameWindow States example.
2014-04-24 13:45:06 +02:00
Olle Håkansson 374ce26186 Added a helper for creating cocoa window infos. 2014-04-24 13:45:05 +02:00
Olle Håkansson 86a5399534 Register mouse drag as well as move. 2014-04-24 13:45:05 +02:00
Olle Håkansson 46856dc21d Closing should occur in ProcessEvents. 2014-04-24 13:45:05 +02:00
Olle Håkansson ed87814a7f Cleanups. 2014-04-24 13:45:05 +02:00
Olle Håkansson 3798d268dc Fixed mouse position not being received. 2014-04-24 13:45:05 +02:00
Olle Håkansson 9183e3ae0d Fixed crashes from callbacks. 2014-04-24 13:45:05 +02:00
Olle Håkansson d1fb2597bb Better handling of maximized window.
Used the “zoom” command before, but it has some limitations (e.g. no
event when zoom is done).
2014-04-24 13:45:05 +02:00