Blender V5.0
GHOST_SystemWin32 Class Reference

#include <GHOST_SystemWin32.hh>

Inherits GHOST_System.

Public Member Functions

 GHOST_SystemWin32 ()
 ~GHOST_SystemWin32 () override
uint64_t performanceCounterToMillis (__int64 perf_ticks) const
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
GHOST_IWindowgetWindowUnderCursor (int32_t, int32_t) 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
uint32_t getCursorPreferredLogicalSize () const override
GHOST_TSuccess getModifierKeys (GHOST_ModifierKeys &keys) const override
GHOST_TSuccess getButtons (GHOST_Buttons &buttons) const override
GHOST_TCapabilityFlag getCapabilities () const override
char * getClipboard (bool selection) const override
void putClipboard (const char *buffer, bool selection) const override
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
void setTabletAPI (GHOST_TTabletAPI api) override
void initDebug (GHOST_Debug debug) 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
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
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
GHOST_TTabletAPI getTabletAPI ()
GHOST_TSuccess pushEvent (const GHOST_IEvent *event)
GHOST_TimerManagergetTimerManager () const
GHOST_EventManagergetEventManager () const
GHOST_WindowManagergetWindowManager () const
bool isDebugEnabled () override

Static Public Member Functions

static GHOST_ContextD3DcreateOffscreenContextD3D ()
static GHOST_TSuccess disposeContextD3D (GHOST_ContextD3D *context)
static GHOST_TSuccess pushDragDropEvent (GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType, GHOST_WindowWin32 *window, int mouseX, int mouseY, void *data)
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

GHOST_TSuccess init () override
GHOST_TSuccess exit () override
GHOST_TKey convertKey (short vKey, short ScanCode, short extend) const
GHOST_TKey hardKey (RAWINPUT const &raw, bool *r_key_down)
GHOST_TKey processSpecialKey (short vKey, short scanCode) const
void driveTrackpad ()
void processTrackpad ()
void handleKeyboardChange ()
bool setConsoleWindowState (GHOST_TConsoleWindowState action) override
Protected Member Functions inherited from GHOST_System
 GHOST_System ()
 ~GHOST_System () override
Protected Member Functions inherited from GHOST_ISystem
 GHOST_ISystem ()
virtual ~GHOST_ISystem ()=default

Static Protected Member Functions

static GHOST_EventButtonprocessButtonEvent (GHOST_TEventType type, GHOST_WindowWin32 *window, GHOST_TButton mask)
static void processWintabEvent (GHOST_WindowWin32 *window)
static void processPointerEvent (UINT type, GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam, bool &eventhandled)
static GHOST_EventCursorprocessCursorEvent (GHOST_WindowWin32 *window, const int32_t screen_co[2])
static void processWheelEventVertical (GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam)
static void processWheelEventHorizontal (GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam)
static GHOST_EventKeyprocessKeyEvent (GHOST_WindowWin32 *window, RAWINPUT const &raw)
static GHOST_EventprocessWindowSizeEvent (GHOST_WindowWin32 *window)
static GHOST_EventprocessWindowEvent (GHOST_TEventType type, GHOST_WindowWin32 *window)
static void processMinMaxInfo (MINMAXINFO *minmax)
static LRESULT WINAPI s_wndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)

Protected Attributes

bool has_performance_counter_
__int64 freq_
bool has_alt_gr_
WORD lang_id_
HKL keylayout_
bool console_status_
int wheel_delta_accum_vertical_
int wheel_delta_accum_horizontal_
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_

Additional Inherited Members

Public Attributes inherited from GHOST_System
bool native_pixel_
bool window_focus_
bool auto_focus_
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

WIN32 Implementation of GHOST_System class.

See also
GHOST_System.

Definition at line 40 of file GHOST_SystemWin32.hh.

Constructor & Destructor Documentation

◆ GHOST_SystemWin32()

◆ ~GHOST_SystemWin32()

GHOST_SystemWin32::~GHOST_SystemWin32 ( )
override

Member Function Documentation

◆ convertKey()

GHOST_TKey GHOST_SystemWin32::convertKey ( short vKey,
short ScanCode,
short extend ) const
protected

Converts raw WIN32 key codes from the wndproc to GHOST keys.

Parameters
vKeyThe virtual key from hardKey.
ScanCodeThe ScanCode of pressed key (similar to PS/2 Set 1).
extendFlag if key is not primly (left or right).
Returns
The GHOST key (GHOST_kKeyUnknown if no match).

Definition at line 737 of file GHOST_SystemWin32.cc.

References GHOST_ISystem::getSystem(), GHOST_kKey0, GHOST_kKeyA, GHOST_kKeyAccentGrave, GHOST_kKeyApp, GHOST_kKeyBackslash, GHOST_kKeyBackSpace, GHOST_kKeyCapsLock, GHOST_kKeyComma, GHOST_kKeyDelete, GHOST_kKeyDownArrow, GHOST_kKeyDownPage, GHOST_kKeyEnd, GHOST_kKeyEnter, GHOST_kKeyEqual, GHOST_kKeyEsc, GHOST_kKeyF1, GHOST_kKeyGrLess, GHOST_kKeyHome, GHOST_kKeyInsert, GHOST_kKeyLeftAlt, GHOST_kKeyLeftArrow, GHOST_kKeyLeftBracket, GHOST_kKeyLeftControl, GHOST_kKeyLeftOS, GHOST_kKeyLeftShift, GHOST_kKeyMediaFirst, GHOST_kKeyMediaLast, GHOST_kKeyMediaPlay, GHOST_kKeyMediaStop, GHOST_kKeyMinus, GHOST_kKeyNumLock, GHOST_kKeyNumpad0, GHOST_kKeyNumpad1, GHOST_kKeyNumpad2, GHOST_kKeyNumpad3, GHOST_kKeyNumpad4, GHOST_kKeyNumpad5, GHOST_kKeyNumpad6, GHOST_kKeyNumpad7, GHOST_kKeyNumpad8, GHOST_kKeyNumpad9, GHOST_kKeyNumpadAsterisk, GHOST_kKeyNumpadEnter, GHOST_kKeyNumpadMinus, GHOST_kKeyNumpadPeriod, GHOST_kKeyNumpadPlus, GHOST_kKeyNumpadSlash, GHOST_kKeyPause, GHOST_kKeyPeriod, GHOST_kKeyPrintScreen, GHOST_kKeyRightAlt, GHOST_kKeyRightArrow, GHOST_kKeyRightBracket, GHOST_kKeyRightControl, GHOST_kKeyRightOS, GHOST_kKeyRightShift, GHOST_kKeyScrollLock, GHOST_kKeySemicolon, GHOST_kKeySlash, GHOST_kKeySpace, GHOST_kKeyTab, GHOST_kKeyUnknown, GHOST_kKeyUpArrow, GHOST_kKeyUpPage, GHOST_SystemWin32(), VK_BACK_QUOTE, VK_BACK_SLASH, VK_CLOSE_BRACKET, VK_COMMA, VK_EQUALS, VK_GR_LESS, VK_MINUS, VK_OPEN_BRACKET, VK_PERIOD, VK_SEMICOLON, and VK_SLASH.

Referenced by hardKey().

◆ createOffscreenContext()

GHOST_IContext * GHOST_SystemWin32::createOffscreenContext ( GHOST_GPUSettings gpu_settings)
overridevirtual

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

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

Implements GHOST_System.

Definition at line 307 of file GHOST_SystemWin32.cc.

References GHOST_GPUSettings::context_type, GHOST_CONTEXT_PARAMS_FROM_GPU_SETTINGS_OFFSCREEN, GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY, GHOST_ContextParams::is_debug, and GHOST_GPUSettings::preferred_device.

◆ createOffscreenContextD3D()

GHOST_ContextD3D * GHOST_SystemWin32::createOffscreenContextD3D ( )
static

Create a new off-screen DirectX context. Never explicitly delete the context, use disposeContext() instead. This is for GHOST internal, Win32 specific use, so it can be called statically.

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

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

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

Definition at line 390 of file GHOST_SystemWin32.cc.

References GHOST_CONTEXT_PARAMS_NONE.

Referenced by GHOST_XrGraphicsBindingD3D::GHOST_XrGraphicsBindingD3D().

◆ createWindow()

GHOST_IWindow * GHOST_SystemWin32::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 window.
Returns
The new window (or 0 if creation failed).

Implements GHOST_ISystem.

Definition at line 263 of file GHOST_SystemWin32.cc.

References GHOST_GPUSettings::context_type, GHOST_WindowWin32::getValid(), GHOST_CONTEXT_PARAMS_FROM_GPU_SETTINGS, GHOST_PRINT, left, GHOST_GPUSettings::preferred_device, state, top, and GHOST_System::window_manager_.

◆ disposeContext()

GHOST_TSuccess GHOST_SystemWin32::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 378 of file GHOST_SystemWin32.cc.

References GHOST_kSuccess.

◆ disposeContextD3D()

GHOST_TSuccess GHOST_SystemWin32::disposeContextD3D ( GHOST_ContextD3D * context)
static

Dispose of a DirectX context. This is for GHOST internal, Win32 specific use, so it can be called statically.

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

Definition at line 414 of file GHOST_SystemWin32.cc.

References GHOST_kSuccess.

Referenced by GHOST_XrGraphicsBindingD3D::~GHOST_XrGraphicsBindingD3D().

◆ driveTrackpad()

void GHOST_SystemWin32::driveTrackpad ( )
protected

Drives Direct Manipulation update.

Definition at line 1595 of file GHOST_SystemWin32.cc.

References GHOST_WindowManager::getActiveWindow(), GHOST_System::getWindowManager(), and GHOST_WindowWin32::updateDirectManipulation().

Referenced by processEvents().

◆ exit()

GHOST_TSuccess GHOST_SystemWin32::exit ( )
overrideprotectedvirtual

Closes the system down.

Returns
A success value.

Reimplemented from GHOST_System.

Definition at line 668 of file GHOST_SystemWin32.cc.

References GHOST_System::exit(), and L.

Referenced by ~GHOST_SystemWin32().

◆ getAllDisplayDimensions()

void GHOST_SystemWin32::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 257 of file GHOST_SystemWin32.cc.

◆ getButtons()

GHOST_TSuccess GHOST_SystemWin32::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 597 of file GHOST_SystemWin32.cc.

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

◆ getCapabilities()

GHOST_TCapabilityFlag GHOST_SystemWin32::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 615 of file GHOST_SystemWin32.cc.

References GHOST_CAPABILITY_FLAG_ALL, GHOST_kCapabilityClipboardPrimary, GHOST_kCapabilityCursorGenerator, and GHOST_kCapabilityKeyboardHyperKey.

◆ getClipboard()

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

Returns unsigned char from CUT_BUFFER0

Parameters
selectionUsed by X11 only.
Returns
Returns the Clipboard.

Implements GHOST_System.

Definition at line 2429 of file GHOST_SystemWin32.cc.

References alloc_utf_8_from_16(), and len.

◆ getClipboardImage()

uint * GHOST_SystemWin32::getClipboardImage ( int * r_width,
int * r_height ) const
overridevirtual

Get image data from the Clipboard

Parameters
r_widththe returned image width in pixels.
r_heightthe returned image height in pixels.
Returns
pointer uint array in RGBA byte order. Caller must free.

Reimplemented from GHOST_System.

Definition at line 2697 of file GHOST_SystemWin32.cc.

References ELEM, getClipboardImageDibV5(), getClipboardImageFilepath(), and getClipboardImageImBuf().

◆ getCursorPosition()

GHOST_TSuccess GHOST_SystemWin32::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 474 of file GHOST_SystemWin32.cc.

References GHOST_kFailure, GHOST_kSuccess, x, and y.

Referenced by processTrackpad(), and s_wndProc().

◆ getCursorPreferredLogicalSize()

uint32_t GHOST_SystemWin32::getCursorPreferredLogicalSize ( ) const
overridevirtual

Returns
the size of the cursor in logical pixels (before Hi-DPI scaling is applied).

Reimplemented from GHOST_System.

Definition at line 518 of file GHOST_SystemWin32.cc.

References roundf, and size().

◆ getMainDisplayDimensions()

void GHOST_SystemWin32::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 251 of file GHOST_SystemWin32.cc.

◆ getMilliSeconds()

uint64_t GHOST_SystemWin32::getMilliSeconds ( ) const
overridevirtual

Returns the system time. Returns the number of milliseconds since the start of the Blender process. This overloaded method uses the high frequency timer if available.

Returns
The number of milliseconds.

Implements GHOST_ISystem.

Definition at line 213 of file GHOST_SystemWin32.cc.

References count, has_performance_counter_, and performanceCounterToMillis().

Referenced by getMessageTime(), and processEvents().

◆ getModifierKeys()

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

Returns the state of all modifier keys.

Parameters
keysThe state of all modifier keys (true == pressed).
Returns
Indication of success.

Implements GHOST_System.

Definition at line 569 of file GHOST_SystemWin32.cc.

References GHOST_kModifierKeyLeftAlt, GHOST_kModifierKeyLeftControl, GHOST_kModifierKeyLeftOS, GHOST_kModifierKeyLeftShift, GHOST_kModifierKeyRightAlt, GHOST_kModifierKeyRightControl, GHOST_kModifierKeyRightOS, GHOST_kModifierKeyRightShift, GHOST_kSuccess, and GHOST_ModifierKeys::set().

◆ getNumDisplays()

uint8_t GHOST_SystemWin32::getNumDisplays ( ) const
overridevirtual

Returns the number of displays on this system.

Returns
The number of displays.

Implements GHOST_ISystem.

Definition at line 246 of file GHOST_SystemWin32.cc.

◆ getPixelAtCursor()

GHOST_TSuccess GHOST_SystemWin32::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 493 of file GHOST_SystemWin32.cc.

References GHOST_kFailure, and GHOST_kSuccess.

◆ getWindowUnderCursor()

GHOST_IWindow * GHOST_SystemWin32::getWindowUnderCursor ( int32_t ,
int32_t  )
overridevirtual

Get the Window under the mouse cursor. Location obtained from the OS.

Returns
The window under the cursor or nullptr if none.

Reimplemented from GHOST_System.

Definition at line 552 of file GHOST_SystemWin32.cc.

References GHOST_System::window_manager_.

◆ handleKeyboardChange()

void GHOST_SystemWin32::handleKeyboardChange ( )
inlineprotected

Check current key layout for AltGr

Definition at line 497 of file GHOST_SystemWin32.hh.

References has_alt_gr_, i, keylayout_, and lang_id_.

Referenced by GHOST_SystemWin32(), and s_wndProc().

◆ hardKey()

GHOST_TKey GHOST_SystemWin32::hardKey ( RAWINPUT const & raw,
bool * r_key_down )
protected

Catches raw WIN32 key codes from WM_INPUT in the wndproc.

Parameters
rawRawInput structure with detailed info about the key event.
r_key_downSet true when the key is pressed, otherwise false.
Returns
The GHOST key (GHOST_kKeyUnknown if no match).

Definition at line 676 of file GHOST_SystemWin32.cc.

References convertKey().

Referenced by processKeyEvent().

◆ hasClipboardImage()

GHOST_TSuccess GHOST_SystemWin32::hasClipboardImage ( void ) const
overridevirtual

Returns GHOST_kSuccess if the clipboard contains an image.

Reimplemented from GHOST_System.

Definition at line 2507 of file GHOST_SystemWin32.cc.

References alloc_utf_8_from_16(), free(), GHOST_kFailure, GHOST_kSuccess, IB_byte_data, IB_multilayer, IB_test, IMB_freeImBuf(), IMB_load_image_from_filepath(), and result.

◆ init()

GHOST_TSuccess GHOST_SystemWin32::init ( )
overrideprotectedvirtual

Initializes the system. For now, it just registers the window class (WNDCLASS).

Returns
A success value.

Reimplemented from GHOST_System.

Definition at line 630 of file GHOST_SystemWin32.cc.

References freq_, GHOST_kFailure, has_performance_counter_, GHOST_System::init(), initRawInput(), L, and s_wndProc().

◆ initDebug()

void GHOST_SystemWin32::initDebug ( GHOST_Debug debug)
overridevirtual

Specify which debug messages are to be shown.

Parameters
debugFlag for systems to debug.

Reimplemented from GHOST_System.

Definition at line 1504 of file GHOST_SystemWin32.cc.

References GHOST_Debug::flags, GHOST_kDebugWintab, GHOST_System::initDebug(), and GHOST_Wintab::setDebug().

◆ performanceCounterToMillis()

uint64_t GHOST_SystemWin32::performanceCounterToMillis ( __int64 perf_ticks) const

This method converts performance counter measurements into milliseconds since the start of the Blender process.

Returns
The number of milliseconds since the start of the Blender process.

Definition at line 204 of file GHOST_SystemWin32.cc.

References freq_.

Referenced by getMilliSeconds(), and GHOST_WindowWin32::getPointerInfo().

◆ processButtonEvent()

GHOST_EventButton * GHOST_SystemWin32::processButtonEvent ( GHOST_TEventType type,
GHOST_WindowWin32 * window,
GHOST_TButton mask )
staticprotected

Creates mouse button event.

Parameters
typeThe type of event to create.
windowThe window receiving the event (the active window).
maskThe button mask of this event.
Returns
The event created.

Definition at line 931 of file GHOST_SystemWin32.cc.

References GHOST_TabletData::Active, GHOST_WindowWin32::getHWND(), getMessageTime(), GHOST_ISystem::getSystem(), GHOST_WindowWin32::getTabletData(), GHOST_kEventButtonDown, GHOST_kEventButtonUp, GHOST_kEventCursorMove, GHOST_kTabletModeNone, GHOST_SystemWin32(), mask(), MousePressed, MouseReleased, GHOST_System::pushEvent(), GHOST_WindowWin32::updateMouseCapture(), and WINTAB_PRINTF.

Referenced by s_wndProc().

◆ processCursorEvent()

◆ processEvents()

bool GHOST_SystemWin32::processEvents ( bool waitForEvent)
overridevirtual

Gets 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 421 of file GHOST_SystemWin32.cc.

References driveTrackpad(), GHOST_System::event_manager_, GHOST_TimerManager::fireTimers(), getMilliSeconds(), GHOST_System::getTimerManager(), GHOST_kFireTimeNever, next, GHOST_TimerManager::nextFireTime(), and processTrackpad().

◆ processKeyEvent()

GHOST_EventKey * GHOST_SystemWin32::processKeyEvent ( GHOST_WindowWin32 * window,
RAWINPUT const & raw )
staticprotected

Creates a key event and updates the key data stored locally (modifier_keys_). In most cases this is a straightforward conversion of key codes. For the modifier keys however, we want to distinguish left and right keys.

Parameters
windowThe window receiving the event (the active window).
rawRawInput structure with detailed info about the key event.

Definition at line 1317 of file GHOST_SystemWin32.cc.

References conv_utf_16_to_8(), getMessageTime(), GHOST_ISystem::getSystem(), GHOST_kEventKeyDown, GHOST_kEventKeyUp, GHOST_KEY_MODIFIER_CHECK, GHOST_PRINTF, GHOST_SystemWin32(), hardKey(), has_alt_gr_, keylayout_, state, and USHORT.

Referenced by s_wndProc().

◆ processMinMaxInfo()

void GHOST_SystemWin32::processMinMaxInfo ( MINMAXINFO * minmax)
staticprotected

Handles minimum window size.

Parameters
minmaxThe MINMAXINFO structure.

Definition at line 1510 of file GHOST_SystemWin32.cc.

Referenced by s_wndProc().

◆ processPointerEvent()

void GHOST_SystemWin32::processPointerEvent ( UINT type,
GHOST_WindowWin32 * window,
WPARAM wParam,
LPARAM lParam,
bool & eventhandled )
staticprotected

Creates tablet events from pointer events.

Parameters
typeThe type of pointer event.
windowThe window receiving the event (the active window).
wParamThe wParam from the wndproc.
lParamThe lParam from the wndproc.
eventhandledTrue if the method handled the event.

Definition at line 1108 of file GHOST_SystemWin32.cc.

References GHOST_WindowWin32::getPointerInfo(), GHOST_ISystem::getSystem(), GHOST_kEventButtonDown, GHOST_kEventButtonUp, GHOST_kEventCursorMove, GHOST_kSuccess, GHOST_kTabletWinPointer, GHOST_SystemWin32(), i, MousePressed, MouseReleased, GHOST_System::pushEvent(), GHOST_WindowWin32::updateMouseCapture(), and GHOST_WindowWin32::usingTabletAPI().

Referenced by s_wndProc().

◆ processSpecialKey()

GHOST_TKey GHOST_SystemWin32::processSpecialKey ( short vKey,
short scanCode ) const
protected

Process special keys VK_OEM_*, to see if current key layout gives us anything special, like ! on French AZERTY.

Parameters
vKeyThe virtual key from hardKey.
scanCodeThe ScanCode of pressed key (similar to PS/2 Set 1).
Note
this function can be extended to include other exotic cases as they arise.

This function was added in response to bug #25715. This is going to be a long list #42426.

Definition at line 693 of file GHOST_SystemWin32.cc.

References GHOST_kKeyAccentGrave, GHOST_kKeyF13, GHOST_kKeyI, GHOST_kKeyNumpadPeriod, GHOST_kKeyQuote, GHOST_kKeySlash, GHOST_kKeyUnknown, and lang_id_.

◆ processTrackpad()

◆ processWheelEventHorizontal()

void GHOST_SystemWin32::processWheelEventHorizontal ( GHOST_WindowWin32 * window,
WPARAM wParam,
LPARAM lParam )
staticprotected

Handles a horizontal mouse wheel event.

Parameters
windowThe window receiving the event (the active window).
wParamThe wParam from the wndproc.
lParamThe lParam from the wndproc.

This is almost the same as processWheelEventVertical.

Definition at line 1292 of file GHOST_SystemWin32.cc.

References abs, getMessageTime(), GHOST_ISystem::getSystem(), GHOST_kEventWheelAxisHorizontal, GHOST_SystemWin32(), GHOST_System::pushEvent(), and wheel_delta_accum_horizontal_.

Referenced by s_wndProc().

◆ processWheelEventVertical()

void GHOST_SystemWin32::processWheelEventVertical ( GHOST_WindowWin32 * window,
WPARAM wParam,
LPARAM lParam )
staticprotected

Handles a vertical mouse wheel event.

Parameters
windowThe window receiving the event (the active window).
wParamThe wParam from the wndproc.
lParamThe lParam from the wndproc.

Definition at line 1266 of file GHOST_SystemWin32.cc.

References abs, getMessageTime(), GHOST_ISystem::getSystem(), GHOST_kEventWheelAxisVertical, GHOST_SystemWin32(), GHOST_System::pushEvent(), and wheel_delta_accum_vertical_.

Referenced by s_wndProc().

◆ processWindowEvent()

GHOST_Event * GHOST_SystemWin32::processWindowEvent ( GHOST_TEventType type,
GHOST_WindowWin32 * window )
staticprotected

Creates a window event.

Parameters
typeThe type of event to create.
windowThe window receiving the event (the active window).
Returns
The event created.

Definition at line 1442 of file GHOST_SystemWin32.cc.

References getMessageTime(), GHOST_ISystem::getSystem(), GHOST_System::getWindowManager(), GHOST_kEventWindowActivate, GHOST_kEventWindowDeactivate, GHOST_SystemWin32(), GHOST_WindowManager::setActiveWindow(), and GHOST_WindowManager::setWindowInactive().

Referenced by s_wndProc().

◆ processWindowSizeEvent()

GHOST_Event * GHOST_SystemWin32::processWindowSizeEvent ( GHOST_WindowWin32 * window)
staticprotected

Creates a window size event.

Parameters
windowThe window receiving the event (the active window).
Returns
The event created.

Definition at line 1426 of file GHOST_SystemWin32.cc.

References GHOST_System::dispatchEvents(), getMessageTime(), GHOST_ISystem::getSystem(), GHOST_kEventWindowSize, GHOST_SystemWin32(), GHOST_WindowWin32::in_live_resize_, GHOST_System::pushEvent(), and GHOST_WindowWin32::updateHDRInfo().

Referenced by s_wndProc().

◆ processWintabEvent()

◆ pushDragDropEvent()

GHOST_TSuccess GHOST_SystemWin32::pushDragDropEvent ( GHOST_TEventType eventType,
GHOST_TDragnDropTypes draggedObjectType,
GHOST_WindowWin32 * window,
int mouseX,
int mouseY,
void * data )
static

Creates a drag & drop event and pushes it immediately onto the event queue. Called by GHOST_DropTargetWin32 class.

Parameters
eventTypeThe type of drag & drop event
draggedObjectTypeThe type object concerned (currently array of file names, string, ?bitmap)
mouseXx mouse coordinate (in window coordinates)
mouseYy mouse coordinate
windowThe window on which the event occurred
Returns
Indication whether the event was handled.

Definition at line 1467 of file GHOST_SystemWin32.cc.

References data, getMessageTime(), GHOST_ISystem::getSystem(), GHOST_SystemWin32(), and GHOST_System::pushEvent().

◆ putClipboard()

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

Puts buffer to system clipboard.

Parameters
selectionUsed by X11 only.
Returns
No return.

Implements GHOST_System.

Definition at line 2481 of file GHOST_SystemWin32.cc.

References conv_utf_8_to_16(), count_utf_16_from_8(), data, and len.

◆ putClipboardImage()

GHOST_TSuccess GHOST_SystemWin32::putClipboardImage ( uint * rgba,
int width,
int height ) const
overridevirtual

Put image data to the Clipboard

Parameters
rgbauint array in RGBA byte order.
widththe image width in pixels.
heightthe image height in pixels.

Reimplemented from GHOST_System.

Definition at line 2824 of file GHOST_SystemWin32.cc.

References GHOST_kFailure, GHOST_kSuccess, putClipboardImageDibV5(), and putClipboardImagePNG().

◆ s_wndProc()

LRESULT WINAPI GHOST_SystemWin32::s_wndProc ( HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam )
staticprotected

Windows call back routine for our window class.

Definition at line 1641 of file GHOST_SystemWin32.cc.

References GHOST_TabletData::Active, GHOST_System::auto_focus_, GHOST_WindowWin32::clientToScreen(), GHOST_Wintab::disable(), GHOST_System::dispatchEvents(), GHOST_Wintab::enable(), GHOST_Wintab::gainFocus(), GET_POINTERID_WPARAM, getCursorPosition(), GHOST_Window::getCursorShape(), GHOST_Window::getCursorVisibility(), GHOST_System::getEventManager(), GHOST_WindowWin32::getHWND(), GHOST_WindowWin32::getState(), GHOST_ISystem::getSystem(), GHOST_WindowWin32::getTabletData(), GHOST_WindowWin32::getWintab(), GHOST_ASSERT, GHOST_kButtonMaskButton4, GHOST_kButtonMaskButton5, GHOST_kButtonMaskLeft, GHOST_kButtonMaskMiddle, GHOST_kButtonMaskRight, GHOST_kEventButtonDown, GHOST_kEventButtonUp, GHOST_kEventImeComposition, GHOST_kEventImeCompositionEnd, GHOST_kEventImeCompositionStart, GHOST_kEventKeyDown, GHOST_kEventWindowActivate, GHOST_kEventWindowClose, GHOST_kEventWindowDeactivate, GHOST_kEventWindowDPIHintChanged, GHOST_kEventWindowMove, GHOST_kEventWindowUpdate, GHOST_kStandardCursorDefault, GHOST_kTabletModeNone, GHOST_kTabletWintab, GHOST_PRINT, GHOST_SystemWin32(), handleKeyboardChange(), GHOST_WindowWin32::in_live_resize_, L, GHOST_Wintab::leaveRange(), GHOST_WindowWin32::loadCursor(), GHOST_Wintab::loseFocus(), GHOST_WindowWin32::lostMouseCapture(), GHOST_WindowWin32::mouse_present_, GHOST_System::multitouch_gestures_, GHOST_WindowWin32::onPointerHitTest(), processButtonEvent(), processCursorEvent(), GHOST_Wintab::processInfoChange(), processKeyEvent(), processMinMaxInfo(), processPointerEvent(), processWheelEventHorizontal(), processWheelEventVertical(), processWindowEvent(), processWindowSizeEvent(), processWintabEvent(), GHOST_System::pushEvent(), GHOST_Wintab::remapCoordinates(), GHOST_EventManager::removeTypeEvents(), GHOST_WindowWin32::resetPointerPenInfo(), GHOST_WindowWin32::setState(), GHOST_WindowWin32::ThemeRefresh(), UNPACK2, GHOST_Wintab::updateCursorInfo(), GHOST_WindowWin32::updateDPI(), GHOST_WindowWin32::updateHDRInfo(), GHOST_WindowWin32::usingTabletAPI(), wheel_delta_accum_horizontal_, wheel_delta_accum_vertical_, and WINTAB_PRINTF.

Referenced by init().

◆ setConsoleWindowState()

bool GHOST_SystemWin32::setConsoleWindowState ( GHOST_TConsoleWindowState action)
overrideprotectedvirtual

Set the Console State

Parameters
actionconsole state
Returns
current status (1 -visible, 0 - hidden)

Implements GHOST_ISystem.

Definition at line 2955 of file GHOST_SystemWin32.cc.

References console_status_, FALSE, GHOST_kConsoleWindowStateHide, GHOST_kConsoleWindowStateHideForNonConsoleLaunch, GHOST_kConsoleWindowStateShow, GHOST_kConsoleWindowStateToggle, and isStartedFromCommandPrompt().

Referenced by ~GHOST_SystemWin32().

◆ setCursorPosition()

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

Updates the 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 485 of file GHOST_SystemWin32.cc.

References GHOST_kFailure, GHOST_kSuccess, x, and y.

Referenced by processCursorEvent().

◆ setTabletAPI()

◆ showMessageBox()

GHOST_TSuccess GHOST_SystemWin32::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 2842 of file GHOST_SystemWin32.cc.

References alloc_utf16_from_8(), free(), GHOST_DialogError, GHOST_DialogWarning, GHOST_kSuccess, and L.

Member Data Documentation

◆ console_status_

bool GHOST_SystemWin32::console_status_
protected

Console status.

Definition at line 490 of file GHOST_SystemWin32.hh.

Referenced by GHOST_SystemWin32(), and setConsoleWindowState().

◆ freq_

__int64 GHOST_SystemWin32::freq_
protected

High frequency timer variable.

Definition at line 481 of file GHOST_SystemWin32.hh.

Referenced by GHOST_SystemWin32(), init(), and performanceCounterToMillis().

◆ has_alt_gr_

bool GHOST_SystemWin32::has_alt_gr_
protected

AltGr on current keyboard layout.

Definition at line 483 of file GHOST_SystemWin32.hh.

Referenced by handleKeyboardChange(), and processKeyEvent().

◆ has_performance_counter_

bool GHOST_SystemWin32::has_performance_counter_
protected

State variable set at initialization.

Definition at line 479 of file GHOST_SystemWin32.hh.

Referenced by getMilliSeconds(), GHOST_SystemWin32(), and init().

◆ keylayout_

HKL GHOST_SystemWin32::keylayout_
protected

Stores keyboard layout.

Definition at line 487 of file GHOST_SystemWin32.hh.

Referenced by handleKeyboardChange(), and processKeyEvent().

◆ lang_id_

WORD GHOST_SystemWin32::lang_id_
protected

Language identifier.

Definition at line 485 of file GHOST_SystemWin32.hh.

Referenced by handleKeyboardChange(), and processSpecialKey().

◆ wheel_delta_accum_horizontal_

int GHOST_SystemWin32::wheel_delta_accum_horizontal_
protected

Definition at line 494 of file GHOST_SystemWin32.hh.

Referenced by processWheelEventHorizontal(), and s_wndProc().

◆ wheel_delta_accum_vertical_

int GHOST_SystemWin32::wheel_delta_accum_vertical_
protected

Wheel delta accumulators.

Definition at line 493 of file GHOST_SystemWin32.hh.

Referenced by processWheelEventVertical(), and s_wndProc().


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