---
title: "init(mouseEventSource:mouseType:mouseCursorPosition:mouseButton:)"
framework: coregraphics
role: symbol
role_heading: Initializer
path: "coregraphics/cgevent/init(mouseeventsource:mousetype:mousecursorposition:mousebutton:)"
---

# init(mouseEventSource:mouseType:mouseCursorPosition:mouseButton:)

Returns a new Quartz mouse event.

## Declaration

```swift
init?(mouseEventSource source: CGEventSource?, mouseType: CGEventType, mouseCursorPosition: CGPoint, mouseButton: CGMouseButton)
```

## Parameters

- `source`: An event source taken from another event, or NULL.
- `mouseType`: A mouse event type. Pass one of the constants listed in doc://com.apple.coregraphics/documentation/CoreGraphics/CGEventType.
- `mouseCursorPosition`: The position of the mouse cursor in global coordinates.
- `mouseButton`: The button that’s changing state. Pass one of the constants listed in doc://com.apple.coregraphics/documentation/CoreGraphics/CGMouseButton. This parameter is ignored unless the mouseType parameter is kCGEventOtherMouseDown, kCGEventOtherMouseDragged, or kCGEventOtherMouseUp.

## Return Value

Return Value A new mouse event, or NULL if the event could not be created. When you no longer need the event, you should release it using the function CFRelease.

## See Also

### Functions

- [CGAcquireDisplayFadeReservation(_:_:)](coregraphics/cgacquiredisplayfadereservation(_:_:).md)
- [CGAssociateMouseAndMouseCursorPosition(_:)](coregraphics/cgassociatemouseandmousecursorposition(_:).md)
- [CGBeginDisplayConfiguration(_:)](coregraphics/cgbegindisplayconfiguration(_:).md)
- [CGCancelDisplayConfiguration(_:)](coregraphics/cgcanceldisplayconfiguration(_:).md)
- [CGCaptureAllDisplays()](coregraphics/cgcapturealldisplays().md)
- [CGCaptureAllDisplaysWithOptions(_:)](coregraphics/cgcapturealldisplayswithoptions(_:).md)
- [CGCompleteDisplayConfiguration(_:_:)](coregraphics/cgcompletedisplayconfiguration(_:_:).md)
- [CGConfigureDisplayFadeEffect(_:_:_:_:_:_:)](coregraphics/cgconfiguredisplayfadeeffect(_:_:_:_:_:_:).md)
- [CGConfigureDisplayMirrorOfDisplay(_:_:_:)](coregraphics/cgconfiguredisplaymirrorofdisplay(_:_:_:).md)
- [CGConfigureDisplayMode(_:_:_:)](coregraphics/cgconfiguredisplaymode(_:_:_:).md)
- [CGConfigureDisplayOrigin(_:_:_:_:)](coregraphics/cgconfiguredisplayorigin(_:_:_:_:).md)
- [CGConfigureDisplayStereoOperation(_:_:_:_:)](coregraphics/cgconfiguredisplaystereooperation(_:_:_:_:).md)
- [CGConfigureDisplayWithDisplayMode(_:_:_:_:)](coregraphics/cgconfiguredisplaywithdisplaymode(_:_:_:_:).md)
- [CGCursorIsDrawnInFramebuffer()](coregraphics/cgcursorisdrawninframebuffer().md)
- [CGCursorIsVisible()](coregraphics/cgcursorisvisible().md)
