Commit graph

1241 commits

Author SHA1 Message Date
thefiddler ffa3df29eb [X11] Fixed core X11 scrolling and absolute y motions 2014-08-10 02:56:37 +02:00
thefiddler 9ae778a00f [X11] Fixed absolute motion valuators 2014-08-09 22:09:32 +02:00
thefiddler 5a5607eaa5 [X11] Added strong-typed enum for XIValuatorInfo.mode 2014-08-09 22:09:16 +02:00
thefiddler a3e47a2431 [X11] Check before using motion/scroll valuators
These valuators are not available on all systems. We now check
explicitly for support, instead of returning invalid results.

Additionally, unknown valuator names are now printed to the
debug log.
2014-08-09 21:47:09 +02:00
thefiddler 073ddf1bef [X11] Added XGetAtomName() function 2014-08-09 21:46:55 +02:00
thefiddler 5444c0c8b8 [SDL] Workaround for a Mono crash in SDL.JoystickGetGUID
It appears that Mono 3.4.0 fails to marshal SDL_JoystickGUID
correctly when used as a return value. Changing the fixed buffer
to a couple of long fields allows the struct to be marshalled
correctly.
2014-08-09 21:17:49 +02:00
thefiddler e243316e8e [Input] Cleaned up line endings and joystick hat mapping 2014-07-29 23:21:37 +02:00
Andrew O'Connor fe1d465b85 [Input][SDL] Fix JoystickHat bugs
On SDL, DPad inputs were not correctly translated from joystick
hat inputs.
Updated MappedGamePadDriver so that it will correctly recognize
combined joystick hat directions e.g. DPadLeft should be true when
DownLeft, Left, or UpLeft are returned from the joystick hat.
2014-07-27 14:54:36 +01:00
thefiddler e5cd6a3b9e [Input] Implemented JoystickHat GamePad mapping 2014-07-25 23:26:03 +02:00
thefiddler 6db29562cc [Mac] Release input driver before other resources
The input driver relies on the existence of a CFRunLoop. Releasing it
first ensures that a CFRunLoop is available for its complete life cycle.
2014-07-23 23:23:14 +02:00
thefiddler f799530575 [Mac] Do not use autorelease pool
Avoids a potential crash on shutdown.
2014-07-23 23:22:00 +02:00
thefiddler bb882fe700 [Mac] Correctly release mach port
The event tap is released automatically along with the mach port. Fixes
crash on shutdown.
2014-07-23 23:21:04 +02:00
thefiddler 29af70274d [Mac] Removed stored delegate list
The stored delegate list would store delegates indefinitely, causing a
memory leak. It is now the responsibility of each class to maintain
references to any callback functions it defines.
2014-07-23 21:23:25 +02:00
thefiddler 8b1be5c49a [OpenTK] Dispose() now clear the list of resources 2014-07-23 21:20:28 +02:00
thefiddler 57c2f89038 [Mac] Explicitly close removed devices
Devices are now explicitly closed when they a DeviceRemoved event is
received. Additionally, exceptions are no longer allowed to escape into
unmanaged code, where they might crash the runtime.
2014-07-23 21:19:46 +02:00
thefiddler d12643cf44 [Mac] Mark callback calling convention
Callbacks are now explicitly marked as unmanaged pointers with the
correct (platform-defined) calling convention. Exceptions raised inside
these callbacks are no longer allowed to escape into unmanaged code,
where they will crash the runtime.

Additionally, the window is now only closed on the UI thread, and only
if it is actually open.
2014-07-23 21:18:34 +02:00
thefiddler a6c4a7c9b5 [Mac] Only dispose context on UI thread 2014-07-23 21:15:16 +02:00
thefiddler e5e9ae0929 [Mac]] Add NSApplication.IsUIThread property
This can be used to check whether it is safe to access UI components in
the calling thread.
2014-07-23 21:14:47 +02:00
thefiddler 050a93d4af [Mac] Resource registration moved to the facades 2014-07-23 14:36:09 +02:00
thefiddler ac2ae4a4bb [Mac] Ensure Cocoa bindings are initialized first 2014-07-23 14:35:51 +02:00
thefiddler ab75ca05c4 [OpenTK] Added IPlatformFactory.RegisterResource() 2014-07-23 14:34:52 +02:00
thefiddler 5d66aaa034 [Mac] Do not set callback delegates to null
This is done automatically by the GC once they are eligible for
collection.
2014-07-23 10:10:37 +02:00
thefiddler 4093b39fac [Mac] Store a reference to callback delegates
This avoids a potential crashes by the GC reclaiming the delegates
prematurely.
2014-07-23 10:10:08 +02:00
thefiddler e81d8da068 [OpenTK] Reduce duplication in GraphicsContextBase
Inheritors now take advantage of base class functionality to avoid
duplicating finalizers and warning messages.
2014-07-23 10:08:57 +02:00
thefiddler 8f03b09dad [Mac] Register platform resources for disposal 2014-07-23 09:21:28 +02:00
thefiddler 77a44b2c8e [OpenTK] Add allocated resource registry 2014-07-23 09:21:20 +02:00
thefiddler 864cc84019 [Mac] Do not execute run loop prematurely
Fixes a potential crash when destroying and recreating OpenTK.Toolkit.
2014-07-23 09:20:51 +02:00
thefiddler b0ceef3ec9 [OpenTK] Additional constructor and doc cleanup 2014-07-23 09:05:29 +02:00
thefiddler 0a0a5d0af7 [Mac] More defensive programming
CocoaNativeWindow now checks for and reports failures to allocate
resources in its constructor. Additionally, it no longer calls UI
methods in the finalizer thread, as those methods will crash on Cocoa.
2014-07-23 09:05:01 +02:00
thefiddler 7cc3e922ee [OpenTK] Re-add static Factory constructor
There are static methods that rely on `OpenTK.Platform.Factory` having
a static constructor. We need to fix those first, before we can remove
this constructor.
2014-07-23 09:03:18 +02:00
thefiddler 9d6b6891e6 [Mac] CursorVisible should only apply when changed
This fixes an issue where `NativeWindow.Dispose()` would move the mouse
cursor.
2014-07-22 21:02:33 +02:00
thefiddler 0c4081f6ef [Mac] Do not use Autorelease pool 2014-07-22 16:29:52 +02:00
thefiddler 5501689d37 [Mac] Added objc_disposeClassPair binding 2014-07-22 16:29:37 +02:00
thefiddler 0e40f63cf2 [Mac] Close CocoaNativeWindow in Dispose()
Also fix various memory management issues regarding the `MouseCursor`
and `Icon` properties.
2014-07-22 16:29:21 +02:00
thefiddler 7956126c8d [Mac] Retain CFRunLoop while it is in use 2014-07-22 16:20:46 +02:00
thefiddler 42e4e0b27e [Mac] Added CFRetain binding 2014-07-22 16:19:43 +02:00
thefiddler 35bdf16f85 [OpenTK] Correctly reinitialize platform factory 2014-07-22 14:29:20 +02:00
thefiddler a047c08d3d [Mac] Correctly shutdown HID input driver 2014-07-22 14:28:48 +02:00
thefiddler 00b531fdef Fixed compilation warnings on Mono 3.4.0 2014-07-21 17:46:39 +02:00
thefiddler e0a3b73130 Cleaned up the remaining obsolete warnings 2014-07-21 16:49:24 +02:00
thefiddler 461fbce45f Cleaned up a number of obsolete warnings 2014-07-21 16:39:58 +02:00
thefiddler ead151ea4f Fixed a large number of warnings 2014-07-21 16:03:37 +02:00
thefiddler ec34d17b21 Fixed a large number of build warnings 2014-07-21 15:03:24 +02:00
Stefanos A 0f1776bdd0 [X11] Use the correct visual info for the context
This also fixes a potential NRE.
2014-07-20 11:31:02 +02:00
Stefanos A. d75a2ce439 [X11] Fix for issue #143
OpenTK will now use the same GLXFBConfig to create the INativeWindow
and IGraphicsContext on Linux/X11. This resolves an issue where OpenGL
3.x contexts could not be created on some graphics drivers (e.g.
nvidia binary.)
2014-07-19 20:39:17 +02:00
thefiddler a13a2f8e66 [X11] Workaround for issue #146
Windows are now unmapped before being destroyed.
2014-07-18 17:16:27 +02:00
thefiddler 786273dd19 [X11] Fixed OnMouseMove being called without mouse movement 2014-07-18 17:02:47 +02:00
thefiddler 00b5174f63 [Linux] Delay input device detection until a key is pressed 2014-07-18 11:23:28 +02:00
thefiddler 07d496d181 [Linux] Fixed OnMouseMove being called without movement 2014-07-18 10:13:45 +02:00
thefiddler a38e267156 [Linux] Additional debugging info on shutdown 2014-07-18 10:05:13 +02:00
thefiddler 51c05ea1a5 [KMS] Correctly restore crtc on exit. 2014-07-18 10:04:57 +02:00
thefiddler 91055336c0 [Linux] Fixed minor typo 2014-07-18 09:45:04 +02:00
thefiddler b23d06eb46 [Linux] Fixed CursorVisible=false behavior 2014-07-18 09:22:12 +02:00
thefiddler a30ec9003b [Linux] Fixed X11 vs KMS detection 2014-07-18 09:19:37 +02:00
thefiddler 4aa2dcf5a3 [Linux] Fixed compilation issue 2014-07-18 09:05:46 +02:00
thefiddler 21bcc5eae1 [Linux] Print libinput seat for each detected device 2014-07-18 09:02:01 +02:00
thefiddler 20747664f4 [KMS] VSync off causes a crash; force VSync on until fixed
VSync off leads to buffer starvation and a crash in
Egl.SwapBuffers. We need to understand why and fix that
before we can disable vsync.
2014-07-17 11:59:38 +02:00
thefiddler 4f037c882a [KMS] Print device names when adding input devices 2014-07-17 11:59:04 +02:00
thefiddler 36bb366638 [Linux] Improved mouse cursor behavior 2014-07-17 11:20:01 +02:00
thefiddler fd6ff962a1 [Linux] Implemented CursorVisible 2014-07-17 09:45:13 +02:00
thefiddler 153522c0a4 [Linux] Implemented MouseCursor 2014-07-17 09:25:16 +02:00
thefiddler 015acba313 [KMS] Implemented INativeWindow.PointToClient/Screen 2014-07-16 14:51:14 +02:00
thefiddler 4c6bb7a38e [Linux] Corrected values for mouse move and scroll events 2014-07-16 14:28:28 +02:00
thefiddler 3881992bf7 [Linux] Implemented INativeWindow keyboard/mouse events
The mouse cursor is now confined to the display bounds.
2014-07-16 14:28:28 +02:00
thefiddler e61b39a1a1 [Linux] Fixed GameWindow.ClientSize values. 2014-07-16 14:28:28 +02:00
thefiddler bef4901659 [Linux] Implemented libinput IMouseDriver2 2014-07-16 14:28:27 +02:00
thefiddler 4406d2db0d [Linux] Fixed keyboard polling 2014-07-16 14:28:27 +02:00
thefiddler 468a8518cb [Linux] Fixed poll() in libinput event loop 2014-07-16 14:28:27 +02:00
thefiddler 67727d2e9b [Linux] Completed libinput keyboard driver implementation 2014-07-16 14:28:27 +02:00
thefiddler c5abbe8030 [Linux] Implemented libinput keyboard input 2014-07-16 14:28:27 +02:00
thefiddler 4a53a5511a [Linux] Disabled TTY keyboard driver in favor of libinput
The TTY keyboard driver requires a robust cleanup method to avoid
hogging the keyboard/console after the process exists. Without
this, it does not make sense to use enable this driver.
2014-07-16 14:28:27 +02:00
thefiddler e7bd311fbd [Linux] Improve checks for TTY 2014-07-16 14:28:27 +02:00
thefiddler 9e73358dd7 [Linux] Implemented TTY and libinput keyboard drivers 2014-07-16 14:28:27 +02:00
thefiddler 97a539258b [Linux] Added stub TTY and libinput IKeyboardDriver2 2014-07-16 14:28:27 +02:00
thefiddler 9bc774f78c [KMS] Query GPUs lazily 2014-07-16 14:28:27 +02:00
thefiddler 69dbdb7d67 [KMS] Fixed Gbm.DestroyDevice entry point 2014-07-16 14:28:27 +02:00
thefiddler 452bafdbb1 [KMS] Fixed NRE in Toolkit.Init(); improved resource cleanup 2014-07-16 14:28:27 +02:00
thefiddler 753032b844 [KMS] Added DRM/GBM framebuffer implementation 2014-07-16 14:28:27 +02:00
thefiddler d8adf92feb [EGL] Added support for desktop GL rendering
On Linux, EGL can be used to initialize a desktop GL context.
This is especially true on KMS, Wayland and Mir.
2014-07-16 14:28:27 +02:00
thefiddler 5da5ac0fa7 [EGL] Egl.GetError() now returns ErrorCode 2014-07-16 14:28:27 +02:00
thefiddler f9d20b5e3e [KMS] Improved GBM surface format selection 2014-07-16 14:28:27 +02:00
thefiddler 6454822116 [KMS] Create window surface 2014-07-16 14:28:27 +02:00
thefiddler 6f6798de62 [KMS] Added new Linux KMS driver 2014-07-16 14:28:27 +02:00
thefiddler c3451530a6 [KMS] Initial implementation 2014-07-16 14:28:27 +02:00
thefiddler c1c6b4269b Merge pull request #149 from thefiddler/mac_stability
[Mac] Improved stability for NSOpenGLPixelFormat
2014-07-15 06:06:41 +00:00
thefiddler 32958ffcce [Mac] Improved stability for NSOpenGLPixelFormat
Non-accelerated contexts are now considered iff no accelerated contexts
are available. Additionally, a GraphicsException will be thrown if
context construction fails for any reason, instead of causing a runtime
crash.
2014-07-14 12:27:28 +02:00
thefiddler f0fd13a23e Merge pull request #138 from thefiddler/xi2exitfix
[X11] Fix hang when exiting XI2 input thread
2014-06-18 10:26:06 +02:00
thefiddler f889835dd5 Merge pull request #135 from thefiddler/xquartz
XQuartz support (X11 on Mac)
2014-06-17 09:06:05 +02:00
thefiddler ea5f1ad1e8 [X11] Send ClientMessage to exit input event loop
To do that, we need a custom InputOnly window. This window is only used
for receiving the exit ClientMessage - XI2 input is still received
through the root window.

Fixes issue https://github.com/mono/MonoGame/issues/2711
2014-06-17 09:05:29 +02:00
thefiddler 7accefea3e [X11] Remove unused XCreateWindow overloads 2014-06-17 08:51:00 +02:00
thefiddler e39e4fbb37 [X11] Construct X11 Factory first if enabled
This allows us to use X11 on Windows and Mac, if explicitly requested
by the user via `ToolkitOptions.Backend`.
2014-06-15 14:32:43 +02:00
thefiddler 9d840e5969 [X11] Added glXQueryVersion DllImport. 2014-06-15 14:30:40 +02:00
thefiddler 9075129df0 [X11] Throw exception if GLX is not supported
You cannot create an X11/OpenGL context without the GLX extension.
OpenTK will now throw a `NotSupportedException` when this condition is
encountered.

In some cases, it may be possible to enable the EGL backend by passing
`GraphicsContextFlags.Embedded` to the `GraphicsContext` constructor.
2014-06-15 14:30:23 +02:00
thefiddler c657b3d11e [X11] Check before monitoring /dev/input
This avoids a crash on non-Linux systems that do not support /dev/input.
2014-06-15 14:29:07 +02:00
thefiddler 8373782fad [Mac] Fix Mouse.GetState() h-wheel
External mice will now report horizontal scrolling in the low-level
`Mouse.GetState()` API. The touchpad apparently creates an emulated
mouse device that does not report horizontal wheel scrolling events.

Touchpad support probably requires a proper multitouch implementation.
2014-06-10 17:43:31 +02:00
thefiddler 5e63c5fa5c [Mac] Add note for higher precision pixel scroll 2014-06-10 16:41:09 +02:00
thefiddler 2a4f634848 [Mac] Match win32 scrolling coordinates 2014-06-10 16:40:44 +02:00
thefiddler 525af589f1 [X11] Match win32 wheel coordinate system
OpenTK uses the win32 wheel coordinate system, where
(+h, +v) = (right, up). XI2 uses (+h, +v) = (right, down)
instead, so we need to flip the vertical offset.

Fixes issue #133 and https://github.com/mono/MonoGame/issues/2686
2014-06-10 14:53:23 +02:00
thefiddler 0fcd47132c Merge pull request #125 from thefiddler/r112
Prepare for 1.1.2 release
2014-05-20 01:11:41 +02:00
thefiddler 5b529647c9 [Mac] Fixed NRE and initial position on 64bit 2014-05-20 01:00:54 +02:00