Blender V5.0
GHOST_SystemX11 Class Reference

#include <GHOST_SystemX11.hh>

Inherits GHOST_System.

Public Member Functions

 GHOST_SystemX11 ()
 ~GHOST_SystemX11 () override
GHOST_TSuccess init () override
uint64_t getMilliSeconds () const override
uint8_t getNumDisplays () const override
void getMainDisplayDimensions (uint32_t &width, uint32_t &height) const override
void getAllDisplayDimensions (uint32_t &width, uint32_t &height) const override
GHOST_IWindowcreateWindow (const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_GPUSettings gpu_settings, const bool exclusive=false, const bool is_dialog=false, const GHOST_IWindow *parent_window=nullptr) override
GHOST_IContextcreateOffscreenContext (GHOST_GPUSettings gpu_settings) override
GHOST_TSuccess disposeContext (GHOST_IContext *context) override
bool processEvents (bool waitForEvent) override
GHOST_TSuccess getCursorPosition (int32_t &x, int32_t &y) const override
GHOST_TSuccess setCursorPosition (int32_t x, int32_t y) override
GHOST_TSuccess getPixelAtCursor (float r_color[3]) const override
GHOST_TSuccess getModifierKeys (GHOST_ModifierKeys &keys) const override
GHOST_TSuccess getButtons (GHOST_Buttons &buttons) const override
GHOST_TCapabilityFlag getCapabilities () const override
void addDirtyWindow (GHOST_WindowX11 *bad_wind)
DisplaygetXDisplay ()
uint64_t ms_from_input_time (const Time timestamp) const
void getClipboard_xcout (const XEvent *evt, Atom sel, Atom target, unsigned char **txt, unsigned long *len, unsigned int *context) const
char * getClipboard (bool selection) const override
void putClipboard (const char *buffer, bool selection) const override
bool setConsoleWindowState (GHOST_TConsoleWindowState) override
Message Box
GHOST_TSuccess showMessageBox (const char *title, const char *message, const char *help_label, const char *continue_label, const char *link, GHOST_DialogOptions dialog_options) const override
Public Member Functions inherited from GHOST_System
GHOST_ITimerTaskinstallTimer (uint64_t delay, uint64_t interval, GHOST_TimerProcPtr timer_proc, GHOST_TUserDataPtr user_data=nullptr) override
GHOST_TSuccess removeTimer (GHOST_ITimerTask *timerTask) override
GHOST_TSuccess disposeWindow (GHOST_IWindow *window) override
bool validWindow (GHOST_IWindow *window) override
bool useNativePixel () override
void useWindowFocus (const bool use_focus) override
void setAutoFocus (const bool auto_focus) override
GHOST_IWindowgetWindowUnderCursor (int32_t x, int32_t y) override
void dispatchEvents () override
GHOST_TSuccess addEventConsumer (GHOST_IEventConsumer *consumer) override
GHOST_TSuccess removeEventConsumer (GHOST_IEventConsumer *consumer) override
GHOST_TSuccess getCursorPositionClientRelative (const GHOST_IWindow *window, int32_t &x, int32_t &y) const override
GHOST_TSuccess setCursorPositionClientRelative (GHOST_IWindow *window, int32_t x, int32_t y) override
uint32_t getCursorPreferredLogicalSize () const override
GHOST_TSuccess getModifierKeyState (GHOST_TModifierKey mask, bool &is_down) const override
GHOST_TSuccess getButtonState (GHOST_TButton mask, bool &is_down) const override
void setMultitouchGestures (const bool use) override
void setTabletAPI (GHOST_TTabletAPI api) override
GHOST_TTabletAPI getTabletAPI ()
GHOST_TSuccess hasClipboardImage () const override
uintgetClipboardImage (int *r_width, int *r_height) const override
GHOST_TSuccess putClipboardImage (uint *rgba, int width, int height) const override
GHOST_TSuccess pushEvent (const GHOST_IEvent *event)
GHOST_TimerManagergetTimerManager () const
GHOST_EventManagergetEventManager () const
GHOST_WindowManagergetWindowManager () const
void initDebug (GHOST_Debug debug) override
bool isDebugEnabled () override

Public Attributes

struct { 
   Atom   WM_STATE 
   Atom   WM_CHANGE_STATE 
   Atom   _NET_WM_STATE 
   Atom   _NET_WM_STATE_MAXIMIZED_HORZ 
   Atom   _NET_WM_STATE_MAXIMIZED_VERT 
   Atom   _NET_WM_STATE_FULLSCREEN 
   Atom   _MOTIF_WM_HINTS 
   Atom   WM_TAKE_FOCUS 
   Atom   WM_PROTOCOLS 
   Atom   WM_DELETE_WINDOW 
   Atom   TARGETS 
   Atom   STRING 
   Atom   C_STRING 
   Atom   COMPOUND_TEXT 
   Atom   TEXT 
   Atom   CLIPBOARD 
   Atom   PRIMARY 
   Atom   XCLIP_OUT 
   Atom   INCR 
   Atom   UTF8_STRING 
atom_
Public Attributes inherited from GHOST_System
bool native_pixel_
bool window_focus_
bool auto_focus_

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_ISystemgetSystem ()
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)
Protected Member Functions inherited from GHOST_System
 GHOST_System ()
 ~GHOST_System () override
GHOST_TSuccess exit () override
Protected Member Functions inherited from GHOST_ISystem
 GHOST_ISystem ()
virtual ~GHOST_ISystem ()=default
Protected Attributes inherited from GHOST_System
GHOST_TimerManagertimer_manager_
GHOST_WindowManagerwindow_manager_
GHOST_EventManagerevent_manager_
bool multitouch_gestures_
GHOST_TTabletAPI tablet_api_
bool is_debug_enabled_
Static Protected Attributes inherited from GHOST_ISystem
static GHOST_ISystemsystem_ = nullptr
static const char * system_backend_id_ = nullptr
static GHOST_TBacktraceFn backtrace_fn_ = nullptr
static bool use_window_frame_ = true

Detailed Description

X11 Implementation of GHOST_System class.

See also
GHOST_System.

Definition at line 60 of file GHOST_SystemX11.hh.

Constructor & Destructor Documentation

◆ GHOST_SystemX11()

◆ ~GHOST_SystemX11()

GHOST_SystemX11::~GHOST_SystemX11 ( )
override

Destructor.

Definition at line 225 of file GHOST_SystemX11.cc.

Member Function Documentation

◆ addDirtyWindow()

void GHOST_SystemX11::addDirtyWindow ( GHOST_WindowX11 * bad_wind)

Flag a window as dirty. This will generate a GHOST window update event on a call to processEvents()

Definition at line 1825 of file GHOST_SystemX11.cc.

References GHOST_ASSERT.

◆ createOffscreenContext()

GHOST_IContext * GHOST_SystemX11::createOffscreenContext ( GHOST_GPUSettings gpu_settings)
overridevirtual

Create a new off-screen context. Never explicitly delete the context, use disposeContext() instead.

Returns
The new context (or 0 if creation failed).

Implements GHOST_System.

Definition at line 403 of file GHOST_SystemX11.cc.

References GHOST_GPUSettings::context_type, GHOST_CONTEXT_PARAMS_FROM_GPU_SETTINGS_OFFSCREEN, GHOST_OPENGL_GLX_CONTEXT_FLAGS, GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY, GHOST_ContextParams::is_debug, and GHOST_GPUSettings::preferred_device.

◆ createWindow()

GHOST_IWindow * GHOST_SystemX11::createWindow ( const char * title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TWindowState state,
GHOST_GPUSettings gpu_settings,
const bool exclusive = false,
const bool is_dialog = false,
const GHOST_IWindow * parent_window = nullptr )
overridevirtual

Create a new window. The new window is added to the list of windows managed. Never explicitly delete the window, use disposeWindow() instead.

Parameters
titleThe name of the window. (displayed in the title bar of the window if the OS supports it).
leftThe coordinate of the left edge of the window.
topThe coordinate of the top edge of the window.
widthThe width the window.
heightThe height the window.
stateThe state of the window when opened.
gpu_settingsMisc GPU settings.
exclusiveUse to show the window on top and ignore others (used full-screen).
parent_windowParent (embedder) window.
Returns
The new window (or 0 if creation failed).

Implements GHOST_ISystem.

Definition at line 352 of file GHOST_SystemX11.cc.

References GHOST_GPUSettings::context_type, getMilliSeconds(), GHOST_WindowX11::getValid(), GHOST_CONTEXT_PARAMS_FROM_GPU_SETTINGS, GHOST_kEventWindowSize, left, GHOST_GPUSettings::preferred_device, pushEvent, state, top, and GHOST_System::window_manager_.

◆ disposeContext()

GHOST_TSuccess GHOST_SystemX11::disposeContext ( GHOST_IContext * context)
overridevirtual

Dispose of a context.

Parameters
contextPointer to the context to be disposed.
Returns
Indication of success.

Implements GHOST_ISystem.

Definition at line 458 of file GHOST_SystemX11.cc.

References GHOST_kSuccess.

◆ getAllDisplayDimensions()

void GHOST_SystemX11::getAllDisplayDimensions ( uint32_t & width,
uint32_t & height ) const
overridevirtual

Returns the dimensions of all displays on this system.

Returns
The dimension of the main display.

Implements GHOST_ISystem.

Definition at line 344 of file GHOST_SystemX11.cc.

Referenced by getMainDisplayDimensions().

◆ getButtons()

GHOST_TSuccess GHOST_SystemX11::getButtons ( GHOST_Buttons & buttons) const
overridevirtual

Returns the state of the mouse buttons (outside the message queue).

Parameters
buttonsThe state of the buttons.
Returns
Indication of success.

Implements GHOST_System.

Definition at line 1686 of file GHOST_SystemX11.cc.

References GHOST_kButtonMaskButton4, GHOST_kButtonMaskButton5, GHOST_kButtonMaskLeft, GHOST_kButtonMaskMiddle, GHOST_kButtonMaskRight, GHOST_kFailure, GHOST_kSuccess, and GHOST_Buttons::set().

◆ getCapabilities()

GHOST_TCapabilityFlag GHOST_SystemX11::getCapabilities ( ) const
overridevirtual

Return features supported by the system back-end.

The resulting value doesn't change at run-time.

Implements GHOST_ISystem.

Definition at line 1807 of file GHOST_SystemX11.cc.

References GHOST_CAPABILITY_FLAG_ALL, GHOST_kCapabilityClipboardImage, GHOST_kCapabilityCursorGenerator, GHOST_kCapabilityCursorRGBA, GHOST_kCapabilityInputIME, and GHOST_kCapabilityWindowDecorationStyles.

◆ getClipboard()

char * GHOST_SystemX11::getClipboard ( bool selection) const
overridevirtual

Returns unsigned char from CUT_BUFFER0

Parameters
selectionGet selection, X11 only feature.
Returns
Returns the Clipboard indicated by Flag.

Implements GHOST_System.

Definition at line 2236 of file GHOST_SystemX11.cc.

References atom_, free(), getClipboard_xcout(), GHOST_WindowX11::getXWindow(), None, txt_cut_buffer, txt_select_buffer, GHOST_System::window_manager_, XCLIB_XCOUT_FALLBACK, XCLIB_XCOUT_FALLBACK_COMP, XCLIB_XCOUT_FALLBACK_TEXT, XCLIB_XCOUT_FALLBACK_UTF8, and XCLIB_XCOUT_NONE.

◆ getClipboard_xcout()

void GHOST_SystemX11::getClipboard_xcout ( const XEvent * evt,
Atom sel,
Atom target,
unsigned char ** txt,
unsigned long * len,
unsigned int * context ) const

◆ getCursorPosition()

GHOST_TSuccess GHOST_SystemX11::getCursorPosition ( int32_t & x,
int32_t & y ) const
overridevirtual

Returns the current location of the cursor (location in screen coordinates)

Parameters
xThe x-coordinate of the cursor.
yThe y-coordinate of the cursor.
Returns
Indication of success.

Implements GHOST_ISystem.

Definition at line 1743 of file GHOST_SystemX11.cc.

References getCursorPosition_impl(), x, and y.

Referenced by getPixelAtCursor(), and setCursorPosition().

◆ getMainDisplayDimensions()

void GHOST_SystemX11::getMainDisplayDimensions ( uint32_t & width,
uint32_t & height ) const
overridevirtual

Returns the dimensions of the main display on this system.

Returns
The dimension of the main display.

Implements GHOST_ISystem.

Definition at line 334 of file GHOST_SystemX11.cc.

References getAllDisplayDimensions().

◆ getMilliSeconds()

uint64_t GHOST_SystemX11::getMilliSeconds ( ) const
overridevirtual

Inherited from GHOST_ISystem

Returns the system time. Returns the number of milliseconds since the start of the system process.

Returns
The number of milliseconds.

Implements GHOST_ISystem.

Definition at line 259 of file GHOST_SystemX11.cc.

References GHOST_ASSERT.

Referenced by createWindow(), ms_from_input_time(), and processEvents().

◆ getModifierKeys()

GHOST_TSuccess GHOST_SystemX11::getModifierKeys ( GHOST_ModifierKeys & keys) const
overridevirtual

◆ getNumDisplays()

uint8_t GHOST_SystemX11::getNumDisplays ( ) const
overridevirtual

Returns the number of displays on this system.

Returns
The number of displays.

Implements GHOST_ISystem.

Definition at line 329 of file GHOST_SystemX11.cc.

◆ getPixelAtCursor()

GHOST_TSuccess GHOST_SystemX11::getPixelAtCursor ( float r_color[3]) const
overridevirtual

Get the color of the pixel at the current mouse cursor location

Parameters
r_colorreturned sRGB float colors
Returns
Success value (true == successful and supported by platform)

Reimplemented from GHOST_System.

Definition at line 1605 of file GHOST_SystemX11.cc.

References getCursorPosition(), GHOST_kFailure, GHOST_kSuccess, x, and y.

◆ getXDisplay()

Display * GHOST_SystemX11::getXDisplay ( )
inline

return a pointer to the X11 display structure

Definition at line 191 of file GHOST_SystemX11.hh.

References Display.

◆ init()

GHOST_TSuccess GHOST_SystemX11::init ( )
overridevirtual

Initialize the system.

Returns
Indication of success.

Reimplemented from GHOST_System.

Definition at line 245 of file GHOST_SystemX11.cc.

References GHOST_kFailure, GHOST_kSuccess, and GHOST_System::init().

◆ ms_from_input_time()

uint64_t GHOST_SystemX11::ms_from_input_time ( const Time timestamp) const

Use this function instead of GHOST_System::getMilliSeconds, passing in the time-stamp from X to input to get the event time-stamp with an offset applied to make it compatible with getMilliSeconds.

Definition at line 270 of file GHOST_SystemX11.cc.

References getMilliSeconds(), UINT32_MAX, and UNLIKELY.

Referenced by processEvents().

◆ processEvents()

bool GHOST_SystemX11::processEvents ( bool waitForEvent)
overridevirtual

Retrieves events from the system and stores them in the queue.

Parameters
waitForEventFlag to wait for an event (or return immediately).
Returns
Indication of the presence of events.

Implements GHOST_ISystem.

Definition at line 591 of file GHOST_SystemX11.cc.

References ARRAY_SIZE, ELEM, GHOST_TimerManager::fireTimers(), getMilliSeconds(), GHOST_System::getTimerManager(), GHOST_kEventKeyDown, ghost_key_from_keysym(), GHOST_kFireTimeNever, GHOST_PRINT, i, ms_from_input_time(), next, GHOST_TimerManager::nextFireTime(), processEvents(), pushEvent, and SleepTillEvent().

Referenced by processEvents().

◆ putClipboard()

void GHOST_SystemX11::putClipboard ( const char * buffer,
bool selection ) const
overridevirtual

Puts buffer to system clipboard

Parameters
bufferThe buffer to copy to the clipboard.
selectionSet the selection into the clipboard, X11 only feature.

Implements GHOST_System.

Definition at line 2348 of file GHOST_SystemX11.cc.

References atom_, free(), GHOST_WindowX11::getXWindow(), txt_cut_buffer, txt_select_buffer, and GHOST_System::window_manager_.

◆ setConsoleWindowState()

bool GHOST_SystemX11::setConsoleWindowState ( GHOST_TConsoleWindowState )
inlineoverridevirtual
See also
GHOST_ISystem

Implements GHOST_ISystem.

Definition at line 270 of file GHOST_SystemX11.hh.

◆ setCursorPosition()

GHOST_TSuccess GHOST_SystemX11::setCursorPosition ( int32_t x,
int32_t y )
overridevirtual

Updates the location of the cursor (location in screen coordinates). Not all operating systems allow the cursor to be moved (without the input device being moved).

Parameters
xThe x-coordinate of the cursor.
yThe y-coordinate of the cursor.
Returns
Indication of success.

Implements GHOST_ISystem.

Definition at line 1749 of file GHOST_SystemX11.cc.

References getCursorPosition(), getCursorPosition_impl(), GHOST_kFailure, GHOST_kSuccess, None, x, and y.

◆ showMessageBox()

GHOST_TSuccess GHOST_SystemX11::showMessageBox ( const char * title,
const char * message,
const char * help_label,
const char * continue_label,
const char * link,
GHOST_DialogOptions dialog_options ) const
overridevirtual

Show a system message box

Parameters
titleThe title of the message box.
messageThe message to display.
help_labelHelp button label.
continue_labelContinue button label.
linkAn optional hyperlink.
dialog_optionsOptions how to display the message.

Reimplemented from GHOST_System.

Definition at line 2493 of file GHOST_SystemX11.cc.

References DialogData::drawButton(), e, free(), GHOST_kSuccess, GHOST_PRINTF, DialogData::height, i, DialogData::isInsideButton(), DialogData::line_height, DialogData::padding_x, split(), and DialogData::width.

Referenced by GHOST_WindowX11::GHOST_WindowX11().

Member Data Documentation

◆ _MOTIF_WM_HINTS

Atom GHOST_SystemX11::_MOTIF_WM_HINTS

Definition at line 309 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ _NET_WM_STATE

Atom GHOST_SystemX11::_NET_WM_STATE

Definition at line 305 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ _NET_WM_STATE_FULLSCREEN

Atom GHOST_SystemX11::_NET_WM_STATE_FULLSCREEN

Definition at line 308 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ _NET_WM_STATE_MAXIMIZED_HORZ

Atom GHOST_SystemX11::_NET_WM_STATE_MAXIMIZED_HORZ

Definition at line 306 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ _NET_WM_STATE_MAXIMIZED_VERT

Atom GHOST_SystemX11::_NET_WM_STATE_MAXIMIZED_VERT

Definition at line 307 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ [struct]

struct { ... } GHOST_SystemX11::atom_

◆ C_STRING

Atom GHOST_SystemX11::C_STRING

Definition at line 317 of file GHOST_SystemX11.hh.

◆ CLIPBOARD

Atom GHOST_SystemX11::CLIPBOARD

Definition at line 320 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ COMPOUND_TEXT

Atom GHOST_SystemX11::COMPOUND_TEXT

Definition at line 318 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ INCR

Atom GHOST_SystemX11::INCR

Definition at line 323 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ PRIMARY

Atom GHOST_SystemX11::PRIMARY

Definition at line 321 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ STRING

Atom GHOST_SystemX11::STRING

Definition at line 316 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ TARGETS

Atom GHOST_SystemX11::TARGETS

Definition at line 315 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ TEXT

Atom GHOST_SystemX11::TEXT

Definition at line 319 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ UTF8_STRING

Atom GHOST_SystemX11::UTF8_STRING

Definition at line 324 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ WM_CHANGE_STATE

Atom GHOST_SystemX11::WM_CHANGE_STATE

Definition at line 304 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ WM_DELETE_WINDOW

Atom GHOST_SystemX11::WM_DELETE_WINDOW

Definition at line 312 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ WM_PROTOCOLS

Atom GHOST_SystemX11::WM_PROTOCOLS

Definition at line 311 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ WM_STATE

Atom GHOST_SystemX11::WM_STATE

Atom used for ICCCM, WM-spec and Motif. We only need get this atom at the start, it's relative to the display not the window and are public for every window that need it.

Definition at line 303 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ WM_TAKE_FOCUS

Atom GHOST_SystemX11::WM_TAKE_FOCUS

Definition at line 310 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().

◆ XCLIP_OUT

Atom GHOST_SystemX11::XCLIP_OUT

Definition at line 322 of file GHOST_SystemX11.hh.

Referenced by GHOST_SystemX11().


The documentation for this class was generated from the following files: