|
Blender V5.0
|
#include <GHOST_System.hh>
Inherits GHOST_ISystem.
Inherited by GHOST_SystemCocoa, GHOST_SystemHeadless, GHOST_SystemSDL, GHOST_SystemWayland, GHOST_SystemWin32, and GHOST_SystemX11.
Public Attributes | |
| bool | native_pixel_ |
| bool | window_focus_ |
| bool | auto_focus_ |
Protected Member Functions | |
| GHOST_System () | |
| ~GHOST_System () override | |
| GHOST_TSuccess | init () override |
| GHOST_TSuccess | exit () override |
| Protected Member Functions inherited from GHOST_ISystem | |
| GHOST_ISystem () | |
| virtual | ~GHOST_ISystem ()=default |
Protected Attributes | |
| GHOST_TimerManager * | timer_manager_ |
| GHOST_WindowManager * | window_manager_ |
| GHOST_EventManager * | event_manager_ |
| bool | multitouch_gestures_ |
| GHOST_TTabletAPI | tablet_api_ |
| bool | 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) |
| static bool | getUseWindowFrame () |
| static void | setUseWindowFrame (bool use_window_frame) |
| Static Protected Attributes inherited from GHOST_ISystem | |
| static GHOST_ISystem * | system_ = nullptr |
| static const char * | system_backend_id_ = nullptr |
| static GHOST_TBacktraceFn | backtrace_fn_ = nullptr |
| static bool | use_window_frame_ = true |
Implementation of platform independent functionality of the GHOST_ISystem interface. GHOST_System is an abstract class because not all methods of GHOST_ISystem are implemented.
Definition at line 37 of file GHOST_System.hh.
|
protected |
Constructor. Protected default constructor to force use of static createSystem member.
Definition at line 20 of file GHOST_System.cc.
References auto_focus_, event_manager_, false, GHOST_kTabletAutomatic, is_debug_enabled_, multitouch_gestures_, native_pixel_, nullptr, tablet_api_, timer_manager_, true, window_focus_, and window_manager_.
Referenced by GHOST_SystemHeadless::createOffscreenContext(), GHOST_SystemHeadless::GHOST_SystemHeadless(), GHOST_SystemSDL::GHOST_SystemSDL(), GHOST_SystemWayland::GHOST_SystemWayland(), and GHOST_SystemX11::GHOST_SystemX11().
|
overrideprotected |
Destructor. Protected default constructor to force use of static dispose member.
Definition at line 36 of file GHOST_System.cc.
References exit().
|
overridevirtual |
Adds the given event consumer to our list.
| consumer | The event consumer to add. |
Implements GHOST_ISystem.
Definition at line 158 of file GHOST_System.cc.
References event_manager_, and GHOST_kFailure.
|
overridepure virtual |
Create a new off-screen context. Never explicitly delete the context, use disposeContext() instead.
Implements GHOST_ISystem.
Implemented in GHOST_SystemCocoa, GHOST_SystemHeadless, GHOST_SystemSDL, GHOST_SystemWayland, GHOST_SystemWin32, and GHOST_SystemX11.
|
overridevirtual |
Inherited from GHOST_ISystem but left pure virtual
virtual bool processEvents(bool waitForEvent) = 0;
Retrieves events from the queue and send them to the event consumers. The event stack will be empty afterwards.
Implements GHOST_ISystem.
Definition at line 142 of file GHOST_System.cc.
References event_manager_, GHOST_ISystem::getMilliSeconds(), and timer_manager_.
Referenced by GHOST_SystemWin32::processWindowSizeEvent(), and GHOST_SystemWin32::s_wndProc().
|
overridevirtual |
Dispose a window.
| window | Pointer to the window to be disposed. |
Implements GHOST_ISystem.
Definition at line 87 of file GHOST_System.cc.
References event_manager_, GHOST_kFailure, and window_manager_.
|
overrideprotectedvirtual |
Shut the system down.
WARNING: exit() may run more than once, since it may need to be called from a derived class destructor. Take it into account when modifying this function.
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemWin32.
Definition at line 294 of file GHOST_System.cc.
References event_manager_, GHOST_kSuccess, timer_manager_, and window_manager_.
Referenced by GHOST_SystemWin32::exit(), and ~GHOST_System().
|
pure virtual |
Returns the state of the mouse buttons (outside the message queue).
| buttons | The state of the buttons. |
Implemented in GHOST_SystemCocoa, GHOST_SystemHeadless, GHOST_SystemSDL, GHOST_SystemWayland, GHOST_SystemWin32, and GHOST_SystemX11.
Referenced by getButtonState().
|
overridevirtual |
Returns the state of a mouse button (outside the message queue).
| mask | The button state to retrieve. |
| is_down | Button state. |
Implements GHOST_ISystem.
Definition at line 234 of file GHOST_System.cc.
References GHOST_Buttons::get(), getButtons(), and mask().
|
overridepure virtual |
Return the clipboard buffer or null.
| selection | Use the "primary" selection. Check the GHOST_kCapabilityClipboardPrimary for backends that support this. |
Implements GHOST_ISystem.
Implemented in GHOST_SystemCocoa, GHOST_SystemHeadless, GHOST_SystemSDL, GHOST_SystemWayland, GHOST_SystemWin32, and GHOST_SystemX11.
|
overridevirtual |
Get image data from the Clipboard
| r_width | the returned image width in pixels. |
| r_height | the returned image height in pixels. |
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemCocoa, GHOST_SystemWayland, and GHOST_SystemWin32.
Definition at line 46 of file GHOST_System.cc.
|
overridevirtual |
Returns the current location of the cursor (location in window coordinates)
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemWayland.
Definition at line 194 of file GHOST_System.cc.
References GHOST_ISystem::getCursorPosition(), GHOST_kSuccess, GHOST_IWindow::screenToClient(), x, and y.
|
overridevirtual |
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemWayland, and GHOST_SystemWin32.
Definition at line 217 of file GHOST_System.cc.
|
inline |
Definition at line 292 of file GHOST_System.hh.
References event_manager_.
Referenced by GHOST_SystemWayland::processEvents(), and GHOST_SystemWin32::s_wndProc().
|
pure virtual |
Returns the state of all modifier keys.
| keys | The state of all modifier keys (true == pressed). |
Implemented in GHOST_SystemCocoa, GHOST_SystemHeadless, GHOST_SystemSDL, GHOST_SystemWayland, GHOST_SystemWin32, and GHOST_SystemX11.
Referenced by getModifierKeyState().
|
overridevirtual |
Inherited from GHOST_ISystem but left pure virtual
GHOST_TSuccess getCursorPosition(int32_t& x, int32_t& y) const = 0; GHOST_TSuccess setCursorPosition(int32_t x, int32_t y)
Returns the state of a modifier key (outside the message queue).
| mask | The modifier key state to retrieve. |
| is_down | The state of a modifier key (true == pressed). |
Implements GHOST_ISystem.
Definition at line 222 of file GHOST_System.cc.
References GHOST_ModifierKeys::get(), getModifierKeys(), and mask().
|
overridevirtual |
Get the color of the pixel at the current mouse cursor location
| r_color | returned sRGB float colors |
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemCocoa, GHOST_SystemWin32, and GHOST_SystemX11.
Definition at line 261 of file GHOST_System.cc.
References GHOST_kFailure.
| GHOST_TTabletAPI GHOST_System::getTabletAPI | ( | ) |
Definition at line 256 of file GHOST_System.cc.
References tablet_api_.
Referenced by GHOST_WindowWin32::GHOST_WindowWin32().
|
inline |
Definition at line 287 of file GHOST_System.hh.
References timer_manager_.
Referenced by GHOST_SystemCocoa::processEvents(), GHOST_SystemSDL::processEvents(), GHOST_SystemWayland::processEvents(), GHOST_SystemWin32::processEvents(), and GHOST_SystemX11::processEvents().
|
inline |
Definition at line 297 of file GHOST_System.hh.
References window_manager_.
Referenced by GHOST_SystemWin32::driveTrackpad(), gwl_window_activate(), gwl_window_frame_update_from_pending_no_lock(), GHOST_SystemWayland::output_scale_update(), GHOST_SystemWayland::output_unref(), GHOST_SystemWayland::processEvents(), GHOST_SystemWin32::processTrackpad(), GHOST_SystemWin32::processWindowEvent(), and GHOST_SystemWin32::setTabletAPI().
|
overridevirtual |
Get the Window under the cursor. Although coordinates of the mouse are supplied, platform- specific implementations are free to ignore these and query the mouse location themselves, due to them possibly being incorrect under certain conditions, for example when using multiple monitors that vary in scale and/or DPI.
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemCocoa, GHOST_SystemHeadless, and GHOST_SystemWin32.
Definition at line 112 of file GHOST_System.cc.
References bounds(), GHOST_IWindow::getClientBounds(), GHOST_IWindow::getState(), GHOST_kWindowStateMinimized, window_manager_, x, and y.
|
overridevirtual |
Returns GHOST_kSuccess if the clipboard contains an image.
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemCocoa, GHOST_SystemWayland, and GHOST_SystemWin32.
Definition at line 41 of file GHOST_System.cc.
References GHOST_kFailure.
|
overrideprotectedvirtual |
Initialize the system.
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemCocoa, GHOST_SystemHeadless, GHOST_SystemWayland, GHOST_SystemWin32, and GHOST_SystemX11.
Definition at line 275 of file GHOST_System.cc.
References event_manager_, GHOST_kFailure, GHOST_kSuccess, timer_manager_, and window_manager_.
Referenced by GHOST_SystemCocoa::init(), GHOST_SystemHeadless::init(), GHOST_SystemWayland::init(), GHOST_SystemWin32::init(), and GHOST_SystemX11::init().
|
overridevirtual |
Specify whether debug messages are to be shown.
| debug | Flag for systems to debug. |
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemWin32.
Definition at line 332 of file GHOST_System.cc.
References GHOST_Debug::flags, GHOST_kDebugDefault, and is_debug_enabled_.
Referenced by GHOST_SystemWin32::initDebug().
|
overridevirtual |
Installs a timer.
| delay | The time to wait for the first call to the #timer_proc (in milliseconds). |
| interval | The interval between calls to the #timer_proc. |
| timer_proc | The callback invoked when the interval expires. |
| user_data | Placeholder for user data. |
Implements GHOST_ISystem.
Definition at line 58 of file GHOST_System.cc.
References GHOST_ISystem::getMilliSeconds(), GHOST_kSuccess, timer, and timer_manager_.
Referenced by gwl_seat_key_repeat_timer_add().
|
overridevirtual |
Check whether debug messages are to be shown.
Implements GHOST_ISystem.
Definition at line 337 of file GHOST_System.cc.
References is_debug_enabled_.
| GHOST_TSuccess GHOST_System::pushEvent | ( | const GHOST_IEvent * | event | ) |
Pushes an event on the stack. To dispatch it, call dispatchEvent() or dispatchEvents(). Do not delete the event!
| event | The event to push on the stack. |
Definition at line 182 of file GHOST_System.cc.
References event_manager_, and GHOST_kFailure.
Referenced by gwl_window_frame_update_from_pending_no_lock(), GHOST_SystemWin32::processButtonEvent(), GHOST_SystemWin32::processPointerEvent(), GHOST_SystemWin32::processTrackpad(), GHOST_SystemWin32::processWheelEventHorizontal(), GHOST_SystemWin32::processWheelEventVertical(), GHOST_SystemWin32::processWindowSizeEvent(), GHOST_SystemWin32::processWintabEvent(), GHOST_SystemWin32::pushDragDropEvent(), and GHOST_SystemWin32::s_wndProc().
|
overridepure virtual |
Put data to the Clipboard
| buffer | The buffer to copy to the clipboard. |
| selection | The clipboard to copy too only used on X11. |
Implements GHOST_ISystem.
Implemented in GHOST_SystemCocoa, GHOST_SystemHeadless, GHOST_SystemSDL, GHOST_SystemWayland, GHOST_SystemWin32, and GHOST_SystemX11.
|
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. |
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemCocoa, GHOST_SystemWayland, and GHOST_SystemWin32.
Definition at line 51 of file GHOST_System.cc.
References GHOST_kFailure.
|
overridevirtual |
Removes the given event consumer to our list.
| consumer | The event consumer to remove. |
Implements GHOST_ISystem.
Definition at line 170 of file GHOST_System.cc.
References event_manager_, and GHOST_kFailure.
|
overridevirtual |
Removes a timer.
| timerTask | Timer task to be removed. |
Implements GHOST_ISystem.
Definition at line 78 of file GHOST_System.cc.
References GHOST_kFailure, and timer_manager_.
Referenced by gwl_seat_key_repeat_timer_remove().
|
overridevirtual |
Focus and raise windows on mouse hover.
Implements GHOST_ISystem.
Definition at line 327 of file GHOST_System.cc.
References auto_focus_.
|
overridevirtual |
Updates the location of the cursor (location in window coordinates).
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemWayland.
Definition at line 207 of file GHOST_System.cc.
References GHOST_IWindow::clientToScreen(), GHOST_ISystem::setCursorPosition(), x, and y.
|
overridevirtual |
Enable multi-touch gestures if supported.
| use | Enable or disable. |
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemWayland.
Definition at line 246 of file GHOST_System.cc.
References multitouch_gestures_.
|
overridevirtual |
Set which tablet API to use. Only affects Windows, other platforms have a single API.
| api | Enum indicating which API to use. |
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemWin32.
Definition at line 251 of file GHOST_System.cc.
References tablet_api_.
Referenced by GHOST_SystemWin32::setTabletAPI().
|
inlineoverridevirtual |
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. |
Implements GHOST_ISystem.
Reimplemented in GHOST_SystemCocoa, GHOST_SystemWin32, and GHOST_SystemX11.
Definition at line 185 of file GHOST_System.hh.
References GHOST_kFailure.
|
overridevirtual |
Native pixel size support (MacBook 'retina').
Implements GHOST_ISystem.
Definition at line 316 of file GHOST_System.cc.
References native_pixel_.
|
overridevirtual |
Focus window after opening, or put them in the background.
Implements GHOST_ISystem.
Definition at line 322 of file GHOST_System.cc.
References window_focus_.
|
overridevirtual |
Returns whether a window is valid.
| window | Pointer to the window to be checked. |
Implements GHOST_ISystem.
Definition at line 107 of file GHOST_System.cc.
References window_manager_.
Referenced by GHOST_SystemCocoa::handleDraggingEvent(), and GHOST_SystemCocoa::handleWindowEvent().
| bool GHOST_System::auto_focus_ |
Definition at line 88 of file GHOST_System.hh.
Referenced by GHOST_System(), GHOST_SystemWin32::s_wndProc(), and setAutoFocus().
|
protected |
The event manager.
Definition at line 266 of file GHOST_System.hh.
Referenced by addEventConsumer(), dispatchEvents(), disposeWindow(), exit(), getEventManager(), GHOST_System(), init(), GHOST_SystemWin32::processEvents(), pushEvent(), and removeEventConsumer().
|
protected |
Definition at line 284 of file GHOST_System.hh.
Referenced by GHOST_System(), initDebug(), and isDebugEnabled().
|
protected |
Use multi-touch gestures.
Definition at line 279 of file GHOST_System.hh.
Referenced by GHOST_System(), GHOST_SystemCocoa::handleMouseEvent(), GHOST_SystemWin32::s_wndProc(), setMultitouchGestures(), and GHOST_SystemWayland::setMultitouchGestures().
| bool GHOST_System::native_pixel_ |
Definition at line 79 of file GHOST_System.hh.
Referenced by GHOST_System(), GHOST_SystemCocoa::handleWindowEvent(), and useNativePixel().
|
protected |
Which tablet API to use.
Definition at line 282 of file GHOST_System.hh.
Referenced by getTabletAPI(), GHOST_System(), and setTabletAPI().
|
protected |
The timer manager.
Definition at line 260 of file GHOST_System.hh.
Referenced by dispatchEvents(), exit(), getTimerManager(), GHOST_System(), init(), installTimer(), and removeTimer().
| bool GHOST_System::window_focus_ |
Definition at line 84 of file GHOST_System.hh.
Referenced by GHOST_System(), GHOST_WindowX11::GHOST_WindowX11(), and useWindowFocus().
|
protected |
The window manager.
Definition at line 263 of file GHOST_System.hh.
Referenced by GHOST_SystemCocoa::createWindow(), GHOST_SystemWayland::createWindow(), GHOST_SystemWin32::createWindow(), GHOST_SystemX11::createWindow(), disposeWindow(), exit(), GHOST_SystemX11::getClipboard(), GHOST_SystemX11::getClipboard_xcout(), getWindowManager(), getWindowUnderCursor(), GHOST_SystemCocoa::getWindowUnderCursor(), GHOST_SystemWin32::getWindowUnderCursor(), GHOST_System(), GHOST_SystemCocoa::handleApplicationBecomeActiveEvent(), GHOST_SystemCocoa::handleKeyEvent(), GHOST_SystemCocoa::handleMouseEvent(), GHOST_SystemCocoa::handleOpenDocumentRequest(), GHOST_SystemCocoa::handleQuitRequest(), GHOST_SystemCocoa::handleTabletEvent(), GHOST_SystemCocoa::handleWindowEvent(), GHOST_SystemCocoa::hasDialogWindow(), init(), GHOST_SystemX11::putClipboard(), GHOST_SystemCocoa::setCursorPosition(), GHOST_SystemCocoa::setMouseCursorPosition(), and validWindow().