Show / Hide Table of Contents

Class MacOSMouseComponent

Inheritance
object
MacOSMouseComponent
Implements
IMouseComponent
IPalComponent
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: OpenTK.Platform.Native.macOS
Assembly: OpenTK.Platform.dll
Syntax
public class MacOSMouseComponent : IMouseComponent, IPalComponent

Properties

CanSetMousePosition

If it's possible to set the position of the mouse using SetGlobalPosition(Vector2).

Declaration
public bool CanSetMousePosition { get; }
Property Value
Type Description
bool
See Also
SetGlobalPosition(Vector2)

Logger

The logger that this component uses to log diagnostic messages.

Declaration
public ILogger? Logger { get; set; }
Property Value
Type Description
ILogger
See Also
ILogger
Logger

Name

Name of the abstraction layer component.

Declaration
public string Name { get; }
Property Value
Type Description
string

Provides

Specifies which PAL components this object provides.

Declaration
public PalComponents Provides { get; }
Property Value
Type Description
PalComponents

SupportsRawMouseMotion

If raw mouse motion is supported on this platform. If this is falseIsRawMouseMotionEnabled(WindowHandle) and EnableRawMouseMotion(WindowHandle, bool) should not be used.

Declaration
public bool SupportsRawMouseMotion { get; }
Property Value
Type Description
bool
See Also
IsRawMouseMotionEnabled(WindowHandle)
EnableRawMouseMotion(WindowHandle, bool)

Methods

EnableRawMouseMotion(WindowHandle, bool)

Enables or disables raw mouse motion for a specific window. When raw mouse motion is enabled the window will receive RawMouseMoveEventArgs events, in addition to the normal MouseMoveEventArgs events. Check that SupportsRawMouseMotion is true before using this.

Declaration
public void EnableRawMouseMotion(WindowHandle window, bool enable)
Parameters
Type Name Description
WindowHandle window

The window to enable or disable raw mouse motion for.

bool enable

Whether to enable or disable raw mouse motion.

See Also
SupportsRawMouseMotion

GetGlobalMouseState(out MouseState)

Fills the state struct with the current mouse state. This function may query the mouse state outside of event processing to get the position of the mouse at the time this function is called. The Position will be the screen mouse position and not virtual coordinates described by Locked. The Position is in window screen coordinates.

Declaration
public void GetGlobalMouseState(out MouseState state)
Parameters
Type Name Description
MouseState state

The current mouse state.

See Also
GetMouseState(WindowHandle, out MouseState)

GetGlobalPosition(out Vector2)

Get the global mouse cursor position. This function may query the mouse position outside of event processing to get the position of the mouse at the time this function is called. The mouse position returned is the mouse position as it is on screen, it will not return virtual coordinates when using Locked.

Declaration
public void GetGlobalPosition(out Vector2 globalPosition)
Parameters
Type Name Description
Vector2 globalPosition

Coordinate of the mouse in screen coordinates.

See Also
GetPosition(WindowHandle, out Vector2)
SetGlobalPosition(Vector2)

GetMouseState(WindowHandle, out MouseState)

Fills the state struct with the current mouse state for the specified window. This function takes into consideration only the mouse events that the specified window has received and does not represent global state. If the window has locked the cursor using Locked, this function will return virtual coordinates (unlike GetGlobalMouseState(out MouseState)). The Position is in window relative coordinates.

Declaration
public void GetMouseState(WindowHandle window, out MouseState state)
Parameters
Type Name Description
WindowHandle window

The window to get the mouse state from.

MouseState state

The current mouse state.

See Also
GetGlobalMouseState(out MouseState)

GetPosition(WindowHandle, out Vector2)

Gets the mouse position as seen from the specified window. This function takes into consideration only the mouse events that the specified window has received and does not represent global state. If the window has locked the cursor using Locked, this function will return virtual coordinates (unlike GetGlobalPosition(out Vector2i)).

Declaration
public void GetPosition(WindowHandle window, out Vector2 position)
Parameters
Type Name Description
WindowHandle window

The window to get the mouse position for.

Vector2 position

Coordinate of the mouse in client coordinates.

See Also
GetGlobalPosition(out Vector2)

Initialize(ToolkitOptions)

Initialize the component.

Declaration
public void Initialize(ToolkitOptions options)
Parameters
Type Name Description
ToolkitOptions options

The options to initialize the component with.

See Also
ToolkitOptions
Init(ToolkitOptions)

IsRawMouseMotionEnabled(WindowHandle)

Returns whether raw mouse motion is enabled for the given window or not. Check that SupportsRawMouseMotion is true before using this.

Declaration
public bool IsRawMouseMotionEnabled(WindowHandle window)
Parameters
Type Name Description
WindowHandle window

The window to query.

Returns
Type Description
bool

If raw mouse motion is enabled.

See Also
SupportsRawMouseMotion
EnableRawMouseMotion(WindowHandle, bool)

SetGlobalPosition(Vector2)

Set the global mouse cursor position. Check that CanSetMousePosition is true before using this.

Declaration
public void SetGlobalPosition(Vector2 newGlobalPosition)
Parameters
Type Name Description
Vector2 newGlobalPosition

New coordinate of the mouse in screen space.

See Also
GetGlobalPosition(out Vector2)
CanSetMousePosition

Uninitialize()

Uninitialize the component. Frees any native resources used by the component.

Declaration
public void Uninitialize()
See Also
Uninit()

Implements

IMouseComponent
IPalComponent
In this article
Back to top Generated by DocFX