Blender
V3.3
|
#include <GHOST_SystemCocoa.h>
Protected Member Functions | |
GHOST_TSuccess | init () |
GHOST_TSuccess | setMouseCursorPosition (int32_t x, int32_t y) |
![]() | |
GHOST_System () | |
virtual | ~GHOST_System () |
virtual GHOST_TSuccess | exit () |
GHOST_TSuccess | createFullScreenWindow (GHOST_Window **window, const GHOST_DisplaySetting &settings, const bool stereoVisual, const bool alphaBackground=0) |
![]() | |
GHOST_ISystem () | |
virtual | ~GHOST_ISystem () |
Additional Inherited Members | |
![]() | |
static GHOST_TSuccess | createSystem () |
static GHOST_TSuccess | disposeSystem () |
static GHOST_ISystem * | getSystem () |
static GHOST_TBacktraceFn | getBacktraceFn () |
static void | setBacktraceFn (GHOST_TBacktraceFn backtrace_fn) |
![]() | |
bool | m_nativePixel |
bool | m_windowFocus |
![]() | |
static GHOST_ISystem * | m_system = nullptr |
static GHOST_TBacktraceFn | m_backtrace_fn = nullptr |
Definition at line 24 of file GHOST_SystemCocoa.h.
GHOST_SystemCocoa::GHOST_SystemCocoa | ( | ) |
Constructor.
Definition at line 501 of file GHOST_SystemCocoa.mm.
References free(), GHOST_ASSERT, GHOST_DisplayManager::initialize(), len, GHOST_System::m_displayManager, m_ignoreMomentumScroll, m_ignoreWindowSizedMessages, m_last_warp_timestamp, m_modifierMask, m_multiTouchScroll, m_needDelayedApplicationBecomeActiveEventProcessing, m_outsideLoopEventProcessed, m_start_time, and NULL.
GHOST_SystemCocoa::~GHOST_SystemCocoa | ( | ) |
Destructor.
Definition at line 539 of file GHOST_SystemCocoa.mm.
|
virtual |
Create a new off-screen context. Never explicitly delete the context, use disposeContext() instead.
Implements GHOST_System.
Definition at line 768 of file GHOST_SystemCocoa.mm.
References blender::compositor::context, and NULL.
|
virtual |
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. |
type | The type of drawing context installed in this window. |
glSettings | Misc OpenGL settings. |
exclusive | Use to show the window ontop and ignore others (used fullscreen). |
parentWindow | Parent (embedder) window. |
Implements GHOST_ISystem.
Definition at line 702 of file GHOST_SystemCocoa.mm.
References GHOST_WindowManager::addWindow(), bottom, GHOST_GLSettings::flags, getMilliSeconds(), GHOST_IWindow::getValid(), GHOST_ASSERT, GHOST_glDebugContext, GHOST_glStereoVisual, GHOST_kEventWindowActivate, GHOST_kEventWindowSize, GHOST_PRINT, height, left, GHOST_System::m_windowManager, NULL, GHOST_System::pushEvent(), GHOST_WindowManager::setActiveWindow(), state, top, type, and width.
|
virtual |
Dispose of a context.
context | Pointer to the context to be disposed. |
Implements GHOST_ISystem.
Definition at line 784 of file GHOST_SystemCocoa.mm.
References blender::compositor::context, and GHOST_kSuccess.
|
virtual |
Returns the combine dimensions of all monitors.
Implements GHOST_ISystem.
Definition at line 696 of file GHOST_SystemCocoa.mm.
References getMainDisplayDimensions(), height, and width.
|
virtual |
Returns the state of the mouse buttons (outside the message queue).
buttons | The state of the buttons. |
Implements GHOST_System.
Definition at line 885 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().
|
virtual |
Returns Clipboard data
selection | Indicate which buffer to return. |
Implements GHOST_System.
Definition at line 1938 of file GHOST_SystemCocoa.mm.
References NULL.
|
virtual |
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 808 of file GHOST_SystemCocoa.mm.
References GHOST_kSuccess, x, and y.
Referenced by GHOST_WindowCocoa::setWindowCursorGrab().
|
virtual |
Returns the dimensions of the main display on this system.
Implements GHOST_ISystem.
Definition at line 679 of file GHOST_SystemCocoa.mm.
Referenced by getAllDisplayDimensions().
|
virtual |
Returns the system time. Returns the number of milliseconds since the start of the system process. Based on ANSI clock() routine.
Reimplemented from GHOST_System.
Definition at line 658 of file GHOST_SystemCocoa.mm.
References m_start_time, and NULL.
Referenced by createWindow(), DeviceEvent(), handleApplicationBecomeActiveEvent(), handleDraggingEvent(), handleOpenDocumentRequest(), handleQuitRequest(), handleWindowEvent(), processEvents(), and setCursorPosition().
|
virtual |
Returns the state of all modifier keys.
keys | The state of all modifier keys (true == pressed). |
Implements GHOST_System.
Definition at line 873 of file GHOST_SystemCocoa.mm.
References GHOST_kModifierKeyLeftAlt, GHOST_kModifierKeyLeftControl, GHOST_kModifierKeyLeftShift, GHOST_kModifierKeyOS, GHOST_kSuccess, m_modifierMask, and GHOST_ModifierKeys::set().
|
virtual |
Returns the number of displays on this system.
Implements GHOST_ISystem.
Definition at line 670 of file GHOST_SystemCocoa.mm.
|
virtual |
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 791 of file GHOST_SystemCocoa.mm.
References GHOST_WindowManager::getWindowAssociatedWithOSWindow(), GHOST_System::m_windowManager, x, and y.
GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent | ( | ) |
Handles the Cocoa event telling the application has become active (again)
Definition at line 987 of file GHOST_SystemCocoa.mm.
References GHOST_WindowManager::getActiveWindow(), getMilliSeconds(), GHOST_WindowManager::getWindows(), GHOST_kEventKeyDown, GHOST_kEventKeyUp, GHOST_kFailure, GHOST_kKeyLeftAlt, GHOST_kKeyLeftControl, GHOST_kKeyLeftShift, GHOST_kKeyOS, GHOST_kSuccess, GHOST_WindowCocoa::isDialog(), m_modifierMask, m_needDelayedApplicationBecomeActiveEventProcessing, m_outsideLoopEventProcessed, GHOST_System::m_windowManager, and GHOST_System::pushEvent().
Referenced by processEvents().
GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent | ( | GHOST_TEventType | eventType, |
GHOST_TDragnDropTypes | draggedObjectType, | ||
GHOST_WindowCocoa * | window, | ||
int | mouseX, | ||
int | mouseY, | ||
void * | data | ||
) |
Handles a drag'n'drop destination event. Called by GHOST_WindowCocoa window subclass
eventType | The type of drag'n'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 1128 of file GHOST_SystemCocoa.mm.
References GHOST_WindowCocoa::clientToScreenIntern(), GHOST_TStringArray::count, data, free(), getMilliSeconds(), GHOST_kDragnDropTypeBitmap, GHOST_kDragnDropTypeFilenames, GHOST_kDragnDropTypeString, GHOST_kEventDraggingDropDone, GHOST_kEventDraggingEntered, GHOST_kEventDraggingExited, GHOST_kEventDraggingUpdated, GHOST_kFailure, GHOST_kSuccess, IB_rect, IMB_allocImBuf(), m_outsideLoopEventProcessed, NULL, GHOST_System::pushEvent(), ImBuf::rect, GHOST_TStringArray::strings, GHOST_System::validWindow(), x, and y.
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 1793 of file GHOST_SystemCocoa.mm.
References convertKey(), GHOST_WindowManager::getWindowAssociatedWithOSWindow(), GHOST_kEventKeyDown, GHOST_kEventKeyUp, GHOST_kFailure, GHOST_kKeyDownArrow, GHOST_kKeyF1, GHOST_kKeyF20, GHOST_kKeyLeftAlt, GHOST_kKeyLeftArrow, GHOST_kKeyLeftControl, GHOST_kKeyLeftShift, GHOST_kKeyOS, GHOST_kKeyQ, GHOST_kSuccess, blender::math::length(), m_ignoreMomentumScroll, m_modifierMask, GHOST_System::m_windowManager, NULL, GHOST_System::pushEvent(), type, and x.
Referenced by processEvents().
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 1491 of file GHOST_SystemCocoa.mm.
References bounds(), GHOST_WindowCocoa::clientToScreenIntern(), convertButton(), GHOST_WindowManager::getActiveWindow(), GHOST_WindowCocoa::getClientBounds(), GHOST_Window::getCursorGrabAccum(), GHOST_Window::getCursorGrabAxis(), GHOST_Window::getCursorGrabBounds(), GHOST_Window::getCursorGrabInitPos(), GHOST_Window::getCursorGrabMode(), GHOST_Window::getCursorGrabModeIsWarp(), GHOST_WindowCocoa::getOSWindow(), GHOST_WindowManager::getWindowAssociatedWithOSWindow(), 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, handleTabletEvent(), GHOST_Rect::m_b, m_ignoreMomentumScroll, GHOST_Rect::m_l, m_last_warp_timestamp, GHOST_System::m_multitouchGestures, m_multiTouchScroll, GHOST_Rect::m_r, GHOST_Rect::m_t, GHOST_System::m_windowManager, GHOST_System::pushEvent(), GHOST_WindowCocoa::screenToClient(), GHOST_WindowCocoa::screenToClientIntern(), GHOST_Window::setCursorGrabAccum(), setMouseCursorPosition(), type, GHOST_Rect::wrapPoint(), x, and y.
Handle Cocoa openFile event Display confirmation request panel if changes performed since last save
Definition at line 1378 of file GHOST_SystemCocoa.mm.
References count, GHOST_WindowManager::getActiveWindow(), GHOST_Window::getCursorGrabModeIsWarp(), getMilliSeconds(), GHOST_kEventOpenMainFile, GHOST_kFailure, GHOST_System::m_windowManager, NULL, and GHOST_System::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 1365 of file GHOST_SystemCocoa.mm.
References GHOST_WindowManager::getActiveWindow(), GHOST_Window::getCursorGrabModeIsWarp(), getMilliSeconds(), GHOST_kEventQuitRequest, m_outsideLoopEventProcessed, GHOST_System::m_windowManager, and GHOST_System::pushEvent().
Definition at line 1474 of file GHOST_SystemCocoa.mm.
References handleTabletEvent().
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 1420 of file GHOST_SystemCocoa.mm.
References GHOST_TabletData::Active, FALSE, GHOST_WindowManager::getWindowAssociatedWithOSWindow(), GHOST_ASSERT, GHOST_kFailure, GHOST_kSuccess, GHOST_kTabletModeEraser, GHOST_kTabletModeNone, GHOST_kTabletModeStylus, GHOST_TABLET_DATA_NONE, GHOST_System::m_windowManager, GHOST_TabletData::Pressure, GHOST_TabletData::Xtilt, and GHOST_TabletData::Ytilt.
Referenced by handleMouseEvent(), and handleTabletEvent().
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 1066 of file GHOST_SystemCocoa.mm.
References GHOST_Window::getCursorShape(), GHOST_Window::getCursorVisibility(), getMilliSeconds(), 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(), m_ignoreWindowSizedMessages, GHOST_System::m_nativePixel, m_outsideLoopEventProcessed, GHOST_System::m_windowManager, GHOST_System::pushEvent(), GHOST_WindowManager::setActiveWindow(), GHOST_WindowCocoa::setNativePixelSize(), GHOST_WindowManager::setWindowInactive(), GHOST_Window::updateDrawingContext(), and GHOST_System::validWindow().
bool GHOST_SystemCocoa::hasDialogWindow | ( | ) |
Definition at line 1049 of file GHOST_SystemCocoa.mm.
References GHOST_WindowManager::getWindows(), GHOST_WindowCocoa::isDialog(), and GHOST_System::m_windowManager.
|
protectedvirtual |
Initializes the system. For now, it just registers the window class (WNDCLASS).
Reimplemented from GHOST_System.
Definition at line 543 of file GHOST_SystemCocoa.mm.
References GHOST_System::init(), and CocoaAppDelegate::setSystemCocoa:.
void GHOST_SystemCocoa::notifyExternalEventProcessed | ( | ) |
External objects should call this when they send an event outside processEvents.
Definition at line 1060 of file GHOST_SystemCocoa.mm.
References m_outsideLoopEventProcessed.
Referenced by DeviceEvent().
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 903 of file GHOST_SystemCocoa.mm.
References double(), GHOST_TimerManager::fireTimers(), getMilliSeconds(), GHOST_System::getTimerManager(), GHOST_kFireTimeNever, handleApplicationBecomeActiveEvent(), handleKeyEvent(), m_ignoreWindowSizedMessages, m_needDelayedApplicationBecomeActiveEventProcessing, m_outsideLoopEventProcessed, next, GHOST_TimerManager::nextFireTime(), NULL, and type.
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 1974 of file GHOST_SystemCocoa.mm.
|
inlinevirtual |
|
virtual |
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 821 of file GHOST_SystemCocoa.mm.
References GHOST_WindowManager::getActiveWindow(), GHOST_WindowCocoa::GetCocoaTabletData(), getMilliSeconds(), GHOST_kEventCursorMove, GHOST_kFailure, GHOST_kSuccess, m_outsideLoopEventProcessed, GHOST_System::m_windowManager, GHOST_System::pushEvent(), setMouseCursorPosition(), x, and y.
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 841 of file GHOST_SystemCocoa.mm.
References float(), GHOST_WindowManager::getActiveWindow(), GHOST_WindowCocoa::getScreen(), GHOST_kFailure, GHOST_kSuccess, GHOST_System::m_windowManager, x, and y.
Referenced by handleMouseEvent(), and setCursorPosition().
|
protected |
Temporarily ignore momentum scroll events
Definition at line 303 of file GHOST_SystemCocoa.h.
Referenced by GHOST_SystemCocoa(), handleKeyEvent(), and handleMouseEvent().
|
protected |
Ignores window size messages (when window is dragged).
Definition at line 300 of file GHOST_SystemCocoa.h.
Referenced by GHOST_SystemCocoa(), handleWindowEvent(), and processEvents().
|
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 308 of file GHOST_SystemCocoa.h.
Referenced by GHOST_SystemCocoa(), and handleMouseEvent().
|
protected |
State of the modifiers.
Definition at line 297 of file GHOST_SystemCocoa.h.
Referenced by getModifierKeys(), GHOST_SystemCocoa(), handleApplicationBecomeActiveEvent(), and handleKeyEvent().
|
protected |
Is the scroll wheel event generated by a multi-touch track-pad or mouse?
Definition at line 305 of file GHOST_SystemCocoa.h.
Referenced by GHOST_SystemCocoa(), and handleMouseEvent().
|
protected |
Raised window is not yet known by the window manager, so delay application become active event handling
Definition at line 294 of file GHOST_SystemCocoa.h.
Referenced by GHOST_SystemCocoa(), handleApplicationBecomeActiveEvent(), and processEvents().
|
protected |
Event has been processed directly by Cocoa (or NDOF manager) and has sent a ghost event to be dispatched
Definition at line 290 of file GHOST_SystemCocoa.h.
Referenced by GHOST_SystemCocoa(), handleApplicationBecomeActiveEvent(), handleDraggingEvent(), handleQuitRequest(), handleWindowEvent(), notifyExternalEventProcessed(), processEvents(), and setCursorPosition().
|
protected |
Start time at initialization.
Definition at line 286 of file GHOST_SystemCocoa.h.
Referenced by getMilliSeconds(), and GHOST_SystemCocoa().