|
Blender V4.3
|
#include <GHOST_SystemCocoa.hh>
Inherits GHOST_System.
Protected Member Functions | |
| GHOST_TSuccess | init () override |
| GHOST_TSuccess | setMouseCursorPosition (int32_t x, int32_t y) |
Protected Member Functions inherited from GHOST_System | |
| GHOST_System () | |
| virtual | ~GHOST_System () |
| virtual GHOST_TSuccess | exit () |
| GHOST_TSuccess | createFullScreenWindow (GHOST_Window **window, const GHOST_DisplaySetting &settings, const bool stereoVisual) |
Protected Member Functions inherited from GHOST_ISystem | |
| GHOST_ISystem () | |
| virtual | ~GHOST_ISystem () |
Protected Attributes | |
| bool | m_outsideLoopEventProcessed |
| bool | m_needDelayedApplicationBecomeActiveEventProcessing |
| uint32_t | m_modifierMask |
| bool | m_ignoreWindowSizedMessages |
| bool | m_ignoreMomentumScroll |
| bool | m_multiTouchScroll |
| double | m_last_warp_timestamp |
Protected Attributes inherited from GHOST_System | |
| GHOST_DisplayManager * | m_displayManager |
| GHOST_TimerManager * | m_timerManager |
| GHOST_WindowManager * | m_windowManager |
| GHOST_EventManager * | m_eventManager |
| GHOST_DisplaySetting | m_preFullScreenSetting |
| bool | m_multitouchGestures |
| GHOST_TTabletAPI | m_tabletAPI |
| bool | m_is_debug_enabled |
Additional Inherited Members | |
Static Public Member Functions inherited from GHOST_ISystem | |
| static GHOST_TSuccess | createSystem (bool verbose, bool background) |
| static GHOST_TSuccess | createSystemBackground () |
| static GHOST_TSuccess | disposeSystem () |
| static GHOST_ISystem * | getSystem () |
| static const char * | getSystemBackend () |
| static GHOST_TBacktraceFn | getBacktraceFn () |
| static void | setBacktraceFn (GHOST_TBacktraceFn backtrace_fn) |
Public Attributes inherited from GHOST_System | |
| bool | m_nativePixel |
| bool | m_windowFocus |
| bool | m_autoFocus |
Static Protected Attributes inherited from GHOST_ISystem | |
| static GHOST_ISystem * | m_system = nullptr |
| static const char * | m_system_backend_id = nullptr |
| static GHOST_TBacktraceFn | m_backtrace_fn = nullptr |
Definition at line 25 of file GHOST_SystemCocoa.hh.
| GHOST_SystemCocoa::GHOST_SystemCocoa | ( | ) |
|
override |
Destructor.
Definition at line 554 of file GHOST_SystemCocoa.mm.
|
overridevirtual |
Create a new off-screen context. Never explicitly delete the context, use disposeContext() instead.
Implements GHOST_System.
Definition at line 788 of file GHOST_SystemCocoa.mm.
References GHOST_GPUSettings::context_type, GHOST_GPUSettings::flags, GHOST_gpuDebugContext, and GHOST_GPUSettings::preferred_device.
|
overridevirtual |
Create a new window. The new window is added to the list of windows managed. Never explicitly delete the window, use disposeWindow() instead.
| title | The name of the window. (displayed in the title bar of the window if the OS supports it). |
| left | The coordinate of the left edge of the window. |
| top | The coordinate of the top edge of the window. |
| width | The width the window. |
| height | The height the window. |
| state | The state of the window when opened. |
| gpuSettings | Misc GPU settings. |
| exclusive | Use to show the window on top and ignore others (used full-screen). |
| parentWindow | Parent (embedder) window. |
Implements GHOST_ISystem.
Definition at line 723 of file GHOST_SystemCocoa.mm.
References GHOST_GPUSettings::context_type, GHOST_GPUSettings::flags, GHOST_IWindow::getValid(), GHOST_ASSERT, GHOST_gpuDebugContext, GHOST_gpuStereoVisual, GHOST_kEventWindowActivate, GHOST_kEventWindowSize, GHOST_PRINT, left, GHOST_GPUSettings::preferred_device, pushEvent, and state.
|
overridevirtual |
Dispose of a context.
| context | Pointer to the context to be disposed. |
Implements GHOST_ISystem.
Definition at line 828 of file GHOST_SystemCocoa.mm.
References GHOST_kSuccess.
|
overridevirtual |
Returns the combine dimensions of all monitors.
Implements GHOST_ISystem.
Definition at line 717 of file GHOST_SystemCocoa.mm.
|
overridevirtual |
Returns the state of the mouse buttons (outside the message queue).
| buttons | The state of the buttons. |
Implements GHOST_System.
Definition at line 992 of file GHOST_SystemCocoa.mm.
References GHOST_Buttons::clear(), GHOST_kButtonMaskButton4, GHOST_kButtonMaskButton5, GHOST_kButtonMaskLeft, GHOST_kButtonMaskMiddle, GHOST_kButtonMaskRight, GHOST_kSuccess, and GHOST_Buttons::set().
|
overridevirtual |
Return features supported by the system back-end.
The resulting value doesn't change at run-time.
Implements GHOST_ISystem.
Definition at line 1005 of file GHOST_SystemCocoa.mm.
References GHOST_CAPABILITY_FLAG_ALL, and GHOST_kCapabilityPrimaryClipboard.
|
overridevirtual |
Returns Clipboard data
| selection | Indicate which buffer to return. |
Implements GHOST_System.
Definition at line 1998 of file GHOST_SystemCocoa.mm.
Get image data from the Clipboard
| r_width | the returned image width in pixels. |
| r_height | the returned image height in pixels. |
Reimplemented from GHOST_System.
Definition at line 2089 of file GHOST_SystemCocoa.mm.
References ImBuf::byte_buffer, ImBufByteBuffer::data, getNSImagePixelSize(), IMB_freeImBuf(), NSImageToImBuf(), and NSPasteboardGetImageFile().
|
overridevirtual |
Returns the current location of the cursor (location in screen coordinates)
| x | The x-coordinate of the cursor. |
| y | The y-coordinate of the cursor. |
Implements GHOST_ISystem.
Definition at line 855 of file GHOST_SystemCocoa.mm.
References GHOST_kSuccess.
Referenced by GHOST_WindowCocoa::setWindowCursorGrab().
|
overridevirtual |
Returns the dimensions of the main display on this system.
Implements GHOST_ISystem.
Definition at line 700 of file GHOST_SystemCocoa.mm.
|
overridevirtual |
Returns the system time. Returns the number of milliseconds since the start of the system process. Based on ANSI clock() routine.
Implements GHOST_ISystem.
Definition at line 685 of file GHOST_SystemCocoa.mm.
Referenced by DeviceEvent().
|
overridevirtual |
Returns the state of all modifier keys.
| keys | The state of all modifier keys (true == pressed). |
Implements GHOST_System.
Definition at line 980 of file GHOST_SystemCocoa.mm.
References GHOST_kModifierKeyLeftAlt, GHOST_kModifierKeyLeftControl, GHOST_kModifierKeyLeftOS, GHOST_kModifierKeyLeftShift, GHOST_kSuccess, GHOST_ModifierKeys::set(), and true.
|
overridevirtual |
Returns the number of displays on this system.
Implements GHOST_ISystem.
Definition at line 691 of file GHOST_SystemCocoa.mm.
|
overridevirtual |
Get the color of the pixel at the current mouse cursor location
| r_color | returned sRGB float colors |
Reimplemented from GHOST_System.
Definition at line 889 of file GHOST_SystemCocoa.mm.
References GHOST_kFailure, GHOST_kSuccess, green, and red.
|
overridevirtual |
Get the Window under the cursor.
| x | The x-coordinate of the cursor. |
| y | The y-coordinate of the cursor. |
Reimplemented from GHOST_System.
Definition at line 835 of file GHOST_SystemCocoa.mm.
| GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent | ( | ) |
Handles the Cocoa event telling the application has become active (again)
Definition at line 1108 of file GHOST_SystemCocoa.mm.
References GHOST_kEventKeyDown, GHOST_kEventKeyUp, GHOST_kFailure, GHOST_kKeyLeftAlt, GHOST_kKeyLeftControl, GHOST_kKeyLeftOS, GHOST_kKeyLeftShift, GHOST_kSuccess, GHOST_WindowCocoa::isDialog(), and pushEvent.
| GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent | ( | GHOST_TEventType | eventType, |
| GHOST_TDragnDropTypes | draggedObjectType, | ||
| GHOST_WindowCocoa * | window, | ||
| int | mouseX, | ||
| int | mouseY, | ||
| void * | data ) |
Handles a drag & drop destination event. Called by GHOST_WindowCocoa window subclass.
| eventType | The type of drag & drop event. |
| draggedObjectType | The type object concerned. (currently array of file names, string, TIFF image). |
| mouseX | x mouse coordinate (in cocoa base window coordinates). |
| mouseY | y mouse coordinate. |
| window | The window on which the event occurred. |
Definition at line 1311 of file GHOST_SystemCocoa.mm.
References GHOST_WindowCocoa::clientToScreenIntern(), GHOST_TStringArray::count, data, free(), GHOST_kDragnDropTypeBitmap, GHOST_kDragnDropTypeFilenames, GHOST_kDragnDropTypeString, GHOST_kEventDraggingDropDone, GHOST_kEventDraggingEntered, GHOST_kEventDraggingExited, GHOST_kEventDraggingUpdated, GHOST_kFailure, GHOST_kSuccess, NSImageToImBuf(), pushEvent, and GHOST_TStringArray::strings.
| GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent | ( | void * | eventPtr | ) |
Handles a key event.
| eventPtr | An #NSEvent pointer (cast to void * to enable compilation in standard C++). |
Definition at line 1854 of file GHOST_SystemCocoa.mm.
References convertKey(), GHOST_kEventKeyDown, GHOST_kEventKeyUp, GHOST_kFailure, GHOST_kKeyDownArrow, GHOST_kKeyF1, GHOST_kKeyF20, GHOST_kKeyLeftAlt, GHOST_kKeyLeftArrow, GHOST_kKeyLeftControl, GHOST_kKeyLeftOS, GHOST_kKeyLeftShift, GHOST_kKeyQ, GHOST_kSuccess, printf, and pushEvent.
| GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent | ( | void * | eventPtr | ) |
Handles a mouse event.
| eventPtr | An #NSEvent pointer (cast to void * to enable compilation in standard C++). |
Definition at line 1553 of file GHOST_SystemCocoa.mm.
References bounds(), GHOST_WindowCocoa::clientToScreenIntern(), convertButton(), GHOST_WindowCocoa::getClientBounds(), GHOST_WindowCocoa::GetCocoaTabletData(), GHOST_Window::getCursorGrabAccum(), GHOST_Window::getCursorGrabAxis(), GHOST_Window::getCursorGrabBounds(), GHOST_Window::getCursorGrabInitPos(), GHOST_Window::getCursorGrabMode(), GHOST_Window::getCursorGrabModeIsWarp(), GHOST_WindowCocoa::getOSWindow(), GHOST_kButtonMaskLeft, GHOST_kButtonMaskRight, GHOST_kEventButtonDown, GHOST_kEventButtonUp, GHOST_kEventCursorMove, GHOST_kFailure, GHOST_kGrabDisable, GHOST_kGrabHide, GHOST_kGrabWrap, GHOST_kSuccess, GHOST_kTrackpadEventMagnify, GHOST_kTrackpadEventRotate, GHOST_kTrackpadEventScroll, GHOST_kTrackpadEventSmartMagnify, GHOST_Rect::m_b, GHOST_Rect::m_l, GHOST_Rect::m_r, GHOST_Rect::m_t, pushEvent, GHOST_WindowCocoa::screenToClient(), GHOST_WindowCocoa::screenToClientIntern(), GHOST_Window::setCursorGrabAccum(), GHOST_Rect::wrapPoint(), x, and y.
| bool GHOST_SystemCocoa::handleOpenDocumentRequest | ( | void * | filepathStr | ) |
Handle Cocoa openFile event Display confirmation request panel if changes performed since last save
Definition at line 1436 of file GHOST_SystemCocoa.mm.
References count, GHOST_Window::getCursorGrabModeIsWarp(), GHOST_kEventOpenMainFile, GHOST_kFailure, and pushEvent.
| void GHOST_SystemCocoa::handleQuitRequest | ( | ) |
Handle User request to quit, from Menu bar Quit, and Command+Q Display alert panel if changes performed since last save
Definition at line 1422 of file GHOST_SystemCocoa.mm.
References GHOST_Window::getCursorGrabModeIsWarp(), GHOST_kEventQuitRequest, and pushEvent.
| bool GHOST_SystemCocoa::handleTabletEvent | ( | void * | eventPtr | ) |
Definition at line 1536 of file GHOST_SystemCocoa.mm.
| GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent | ( | void * | eventPtr, |
| short | eventType ) |
Handles a tablet event.
| eventPtr | An #NSEvent pointer (cast to void* to enable compilation in standard C++). |
| eventType | The type of the event. It needs to be passed separately as it can be either directly in the event type, or as a sub-type if combined with a mouse button event. |
Definition at line 1481 of file GHOST_SystemCocoa.mm.
References GHOST_TabletData::Active, FALSE, GHOST_ASSERT, GHOST_kFailure, GHOST_kSuccess, GHOST_kTabletModeEraser, GHOST_kTabletModeNone, GHOST_kTabletModeStylus, GHOST_TABLET_DATA_NONE, GHOST_TabletData::Pressure, GHOST_TabletData::Xtilt, and GHOST_TabletData::Ytilt.
| GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent | ( | GHOST_TEventType | eventType, |
| GHOST_WindowCocoa * | window ) |
Handles a window event. Called by GHOST_WindowCocoa window delegate
| eventType | The type of window event. |
| window | The window on which the event occurred. |
Definition at line 1191 of file GHOST_SystemCocoa.mm.
References GHOST_Window::getCursorShape(), GHOST_Window::getCursorVisibility(), GHOST_kButtonMaskLeft, GHOST_kEventButtonUp, GHOST_kEventNativeResolutionChange, GHOST_kEventWindowActivate, GHOST_kEventWindowClose, GHOST_kEventWindowDeactivate, GHOST_kEventWindowMove, GHOST_kEventWindowSize, GHOST_kEventWindowUpdate, GHOST_kFailure, GHOST_kSuccess, GHOST_TABLET_DATA_NONE, GHOST_WindowCocoa::loadCursor(), pushEvent, GHOST_WindowCocoa::setNativePixelSize(), and GHOST_Window::updateDrawingContext().
|
overridevirtual |
Returns GHOST_kSuccess if the clipboard contains an image.
Reimplemented from GHOST_System.
Definition at line 2065 of file GHOST_SystemCocoa.mm.
References GHOST_kFailure, GHOST_kSuccess, and NSPasteboardGetImageFile().
| bool GHOST_SystemCocoa::hasDialogWindow | ( | ) |
Definition at line 1174 of file GHOST_SystemCocoa.mm.
References GHOST_WindowCocoa::isDialog().
|
overrideprotectedvirtual |
Initializes the system. For now, it just registers the window class (WNDCLASS).
Reimplemented from GHOST_System.
Definition at line 570 of file GHOST_SystemCocoa.mm.
References GHOST_System::init().
| void GHOST_SystemCocoa::notifyExternalEventProcessed | ( | ) |
External objects should call this when they send an event outside processEvents.
Definition at line 1185 of file GHOST_SystemCocoa.mm.
Referenced by DeviceEvent().
|
overridevirtual |
Gets events from the system and stores them in the queue.
| waitForEvent | Flag to wait for an event (or return immediately). |
The event queue polling function
Implements GHOST_ISystem.
Definition at line 1020 of file GHOST_SystemCocoa.mm.
References double(), GHOST_TimerManager::fireTimers(), GHOST_kFireTimeNever, next, and GHOST_TimerManager::nextFireTime().
|
overridevirtual |
Puts buffer to system clipboard
| buffer | The buffer to be copied. |
| selection | Indicates which buffer to copy too, only used on X11. |
Implements GHOST_System.
Definition at line 2026 of file GHOST_SystemCocoa.mm.
|
overridevirtual |
Put image data to the Clipboard
| rgba | uint array in RGBA byte order. |
| width | the image width in pixels. |
| height | the image height in pixels. |
Reimplemented from GHOST_System.
Definition at line 2137 of file GHOST_SystemCocoa.mm.
References GHOST_kFailure, and GHOST_kSuccess.
|
inlineoverridevirtual |
Implements GHOST_ISystem.
Definition at line 272 of file GHOST_SystemCocoa.hh.
|
overridevirtual |
Updates the location of the cursor (location in screen coordinates).
| x | The x-coordinate of the cursor. |
| y | The y-coordinate of the cursor. |
Implements GHOST_ISystem.
Definition at line 868 of file GHOST_SystemCocoa.mm.
References GHOST_WindowCocoa::GetCocoaTabletData(), GHOST_kEventCursorMove, GHOST_kFailure, GHOST_kSuccess, and pushEvent.
Referenced by GHOST_WindowCocoa::setWindowCursorGrab().
|
protected |
Performs the actual cursor position update (location in screen coordinates).
| x | The x-coordinate of the cursor. |
| y | The y-coordinate of the cursor. |
Definition at line 947 of file GHOST_SystemCocoa.mm.
References float, GHOST_WindowCocoa::getScreen(), GHOST_kFailure, and GHOST_kSuccess.
|
overridevirtual |
Show a system message box
| title | The title of the message box. |
| message | The message to display. |
| help_label | Help button label. |
| continue_label | Continue button label. |
| link | An optional hyperlink. |
| dialog_options | Options how to display the message. |
Reimplemented from GHOST_System.
Definition at line 2179 of file GHOST_SystemCocoa.mm.
References GHOST_DialogError, GHOST_DialogWarning, and GHOST_kSuccess.
|
protected |
Temporarily ignore momentum scroll events
Definition at line 349 of file GHOST_SystemCocoa.hh.
|
protected |
Ignores window size messages (when window is dragged).
Definition at line 346 of file GHOST_SystemCocoa.hh.
|
protected |
To prevent multiple warp, we store the time of the last warp event and ignore mouse moved events generated before that.
Definition at line 354 of file GHOST_SystemCocoa.hh.
|
protected |
State of the modifiers.
Definition at line 343 of file GHOST_SystemCocoa.hh.
|
protected |
Is the scroll wheel event generated by a multi-touch trackpad or mouse?
Definition at line 351 of file GHOST_SystemCocoa.hh.
|
protected |
Raised window is not yet known by the window manager, so delay application become active event handling
Definition at line 340 of file GHOST_SystemCocoa.hh.
|
protected |
Event has been processed directly by Cocoa (or NDOF manager) and has sent a ghost event to be dispatched
Definition at line 336 of file GHOST_SystemCocoa.hh.