Blender  V3.3
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
GHOST_SystemWin32 Class Reference

#include <GHOST_SystemWin32.h>

Inheritance diagram for GHOST_SystemWin32:
GHOST_System GHOST_ISystem

Public Member Functions

 GHOST_SystemWin32 ()
 
 ~GHOST_SystemWin32 ()
 
uint64_t performanceCounterToMillis (__int64 perf_ticks) const
 
uint64_t tickCountToMillis (__int64 ticks) const
 
uint64_t getMilliSeconds () const
 
uint8_t getNumDisplays () const
 
void getMainDisplayDimensions (uint32_t &width, uint32_t &height) const
 
void getAllDisplayDimensions (uint32_t &width, uint32_t &height) const
 
GHOST_IWindowcreateWindow (const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_TDrawingContextType type, GHOST_GLSettings glSettings, const bool exclusive=false, const bool is_dialog=false, const GHOST_IWindow *parentWindow=0)
 
GHOST_IContextcreateOffscreenContext (GHOST_GLSettings glSettings)
 
GHOST_TSuccess disposeContext (GHOST_IContext *context)
 
bool processEvents (bool waitForEvent)
 
GHOST_TSuccess getCursorPosition (int32_t &x, int32_t &y) const
 
GHOST_TSuccess setCursorPosition (int32_t x, int32_t y)
 
GHOST_TSuccess getModifierKeys (GHOST_ModifierKeys &keys) const
 
GHOST_TSuccess getButtons (GHOST_Buttons &buttons) const
 
char * getClipboard (bool selection) const
 
void putClipboard (const char *buffer, bool selection) const
 
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
 
- Public Member Functions inherited from GHOST_System
GHOST_ITimerTaskinstallTimer (uint64_t delay, uint64_t interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData=NULL)
 
GHOST_TSuccess removeTimer (GHOST_ITimerTask *timerTask)
 
GHOST_TSuccess disposeWindow (GHOST_IWindow *window)
 
bool validWindow (GHOST_IWindow *window)
 
GHOST_TSuccess beginFullScreen (const GHOST_DisplaySetting &setting, GHOST_IWindow **window, const bool stereoVisual, const bool alphaBackground)
 
GHOST_TSuccess updateFullScreen (const GHOST_DisplaySetting &setting, GHOST_IWindow **window)
 
GHOST_TSuccess endFullScreen (void)
 
bool getFullScreen (void)
 
bool useNativePixel (void)
 
bool supportsCursorWarp (void)
 
bool supportsWindowPosition (void)
 
void useWindowFocus (const bool use_focus)
 
GHOST_IWindowgetWindowUnderCursor (int32_t x, int32_t y)
 
void dispatchEvents ()
 
GHOST_TSuccess addEventConsumer (GHOST_IEventConsumer *consumer)
 
GHOST_TSuccess removeEventConsumer (GHOST_IEventConsumer *consumer)
 
GHOST_TSuccess getCursorPositionClientRelative (const GHOST_IWindow *window, int32_t &x, int32_t &y) const
 
GHOST_TSuccess setCursorPositionClientRelative (GHOST_IWindow *window, int32_t x, int32_t y)
 
GHOST_TSuccess getModifierKeyState (GHOST_TModifierKey mask, bool &isDown) const
 
GHOST_TSuccess getButtonState (GHOST_TButton mask, bool &isDown) const
 
void setMultitouchGestures (const bool use)
 
GHOST_TTabletAPI getTabletAPI (void)
 
GHOST_TSuccess pushEvent (GHOST_IEvent *event)
 
GHOST_TimerManagergetTimerManager () const
 
GHOST_EventManagergetEventManager () const
 
GHOST_WindowManagergetWindowManager () const
 
virtual bool isDebugEnabled ()
 

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 ()
 
static GHOST_TSuccess disposeSystem ()
 
static GHOST_ISystemgetSystem ()
 
static GHOST_TBacktraceFn getBacktraceFn ()
 
static void setBacktraceFn (GHOST_TBacktraceFn backtrace_fn)
 

Protected Member Functions

GHOST_TSuccess init ()
 
GHOST_TSuccess exit ()
 
GHOST_TKey convertKey (short vKey, short ScanCode, short extend) const
 
GHOST_TKey hardKey (RAWINPUT const &raw, bool *r_keyDown, bool *r_is_repeated_modifier)
 
GHOST_TKey processSpecialKey (short vKey, short scanCode) const
 
void driveTrackpad ()
 
void processTrackpad ()
 
void retrieveModifierKeys (GHOST_ModifierKeys &keys) const
 
void storeModifierKeys (const GHOST_ModifierKeys &keys)
 
void handleKeyboardChange (void)
 
int setConsoleWindowState (GHOST_TConsoleWindowState action)
 
- Protected Member Functions inherited from GHOST_System
 GHOST_System ()
 
virtual ~GHOST_System ()
 
GHOST_TSuccess createFullScreenWindow (GHOST_Window **window, const GHOST_DisplaySetting &settings, const bool stereoVisual, const bool alphaBackground=0)
 
- Protected Member Functions inherited from GHOST_ISystem
 GHOST_ISystem ()
 
virtual ~GHOST_ISystem ()
 

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)
 
static void processWheelEvent (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

GHOST_ModifierKeys m_modifierKeys
 
unsigned short m_keycode_last_repeat_key
 
bool m_hasPerformanceCounter
 
__int64 m_freq
 
__int64 m_start
 
__int64 m_lfstart
 
bool m_hasAltGr
 
WORD m_langId
 
HKL m_keylayout
 
int m_consoleStatus
 
int m_wheelDeltaAccum
 
- Protected Attributes inherited from GHOST_System
GHOST_DisplayManagerm_displayManager
 
GHOST_TimerManagerm_timerManager
 
GHOST_WindowManagerm_windowManager
 
GHOST_EventManagerm_eventManager
 
GHOST_DisplaySetting m_preFullScreenSetting
 
bool m_multitouchGestures
 
GHOST_TTabletAPI m_tabletAPI
 
bool m_is_debug_enabled
 

Additional Inherited Members

- Public Attributes inherited from GHOST_System
bool m_nativePixel
 
bool m_windowFocus
 
- Static Protected Attributes inherited from GHOST_ISystem
static GHOST_ISystemm_system = nullptr
 
static GHOST_TBacktraceFn m_backtrace_fn = nullptr
 

Detailed Description

WIN32 Implementation of GHOST_System class.

See also
GHOST_System.

Definition at line 35 of file GHOST_SystemWin32.h.

Constructor & Destructor Documentation

◆ GHOST_SystemWin32()

GHOST_SystemWin32::GHOST_SystemWin32 ( )

◆ ~GHOST_SystemWin32()

GHOST_SystemWin32::~GHOST_SystemWin32 ( )

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 678 of file GHOST_SystemWin32.cpp.

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_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_kKeyOS, GHOST_kKeyPause, GHOST_kKeyPeriod, GHOST_kKeyPrintScreen, GHOST_kKeyRightAlt, GHOST_kKeyRightArrow, GHOST_kKeyRightBracket, GHOST_kKeyRightControl, GHOST_kKeyRightShift, GHOST_kKeyScrollLock, GHOST_kKeySemicolon, GHOST_kKeySlash, GHOST_kKeySpace, GHOST_kKeyTab, GHOST_kKeyUnknown, GHOST_kKeyUpArrow, GHOST_kKeyUpPage, processSpecialKey(), 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_GLSettings  glSettings)
virtual

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 254 of file GHOST_SystemWin32.cpp.

References blender::compositor::context, GHOST_GLSettings::flags, GHOST_glDebugContext, GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY, and NULL.

◆ 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 358 of file GHOST_SystemWin32.cpp.

References blender::compositor::context, GHOST_kFailure, and NULL.

◆ 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_TDrawingContextType  type,
GHOST_GLSettings  glSettings,
const bool  exclusive = false,
const bool  is_dialog = false,
const GHOST_IWindow parentWindow = 0 
)
virtual

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.
typeThe type of drawing context installed in this window.
glSettingsMisc OpenGL settings.
exclusiveUse to show the window ontop and ignore others (used fullscreen).
parentWindowParent window.
Returns
The new window (or 0 if creation failed).

Implements GHOST_ISystem.

Definition at line 208 of file GHOST_SystemWin32.cpp.

References GHOST_WindowManager::addWindow(), GHOST_GLSettings::flags, GHOST_WindowWin32::getValid(), GHOST_glAlphaBackground, GHOST_glDebugContext, GHOST_glStereoVisual, GHOST_PRINT, height, left, GHOST_System::m_windowManager, NULL, GHOST_WindowManager::setActiveWindow(), state, top, type, and width.

◆ disposeContext()

GHOST_TSuccess GHOST_SystemWin32::disposeContext ( GHOST_IContext context)
virtual

Dispose of a context.

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

Implements GHOST_ISystem.

Definition at line 346 of file GHOST_SystemWin32.cpp.

References blender::compositor::context, and 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 382 of file GHOST_SystemWin32.cpp.

References blender::compositor::context, and GHOST_kSuccess.

◆ driveTrackpad()

void GHOST_SystemWin32::driveTrackpad ( )
protected

◆ exit()

GHOST_TSuccess GHOST_SystemWin32::exit ( )
protectedvirtual

Closes the system down.

Returns
A success value.

Reimplemented from GHOST_System.

Definition at line 555 of file GHOST_SystemWin32.cpp.

References GHOST_System::exit().

◆ getAllDisplayDimensions()

void GHOST_SystemWin32::getAllDisplayDimensions ( uint32_t width,
uint32_t height 
) const
virtual

Returns the dimensions of all displays on this system.

Returns
The dimension of the main display.

Implements GHOST_ISystem.

Definition at line 202 of file GHOST_SystemWin32.cpp.

References height, and width.

◆ getButtons()

GHOST_TSuccess GHOST_SystemWin32::getButtons ( GHOST_Buttons buttons) const
virtual

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 487 of file GHOST_SystemWin32.cpp.

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

◆ getClipboard()

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

Returns unsigned char from CUT_BUFFER0

Parameters
selectionUsed by X11 only.
Returns
Returns the Clipboard.

Implements GHOST_System.

Definition at line 2179 of file GHOST_SystemWin32.cpp.

References alloc_utf_8_from_16(), buffer, len, and NULL.

◆ getCursorPosition()

GHOST_TSuccess GHOST_SystemWin32::getCursorPosition ( int32_t x,
int32_t y 
) const
virtual

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 443 of file GHOST_SystemWin32.cpp.

References GHOST_kFailure, GHOST_kSuccess, Freestyle::Nature::POINT, point, x, and y.

Referenced by GHOST_WindowWin32::loadWintab(), processCursorEvent(), and processTrackpad().

◆ getMainDisplayDimensions()

void GHOST_SystemWin32::getMainDisplayDimensions ( uint32_t width,
uint32_t height 
) const
virtual

Returns the dimensions of the main display on this system.

Returns
The dimension of the main display.

Implements GHOST_ISystem.

Definition at line 196 of file GHOST_SystemWin32.cpp.

References height, and width.

◆ getMilliSeconds()

uint64_t GHOST_SystemWin32::getMilliSeconds ( ) const
virtual

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

Returns
The number of milliseconds.

Reimplemented from GHOST_System.

Definition at line 174 of file GHOST_SystemWin32.cpp.

References count, m_hasPerformanceCounter, performanceCounterToMillis(), and tickCountToMillis().

Referenced by processButtonEvent(), processCursorEvent(), processEvents(), processKeyEvent(), processTrackpad(), processWheelEvent(), processWindowEvent(), processWindowSizeEvent(), processWintabEvent(), and pushDragDropEvent().

◆ getModifierKeys()

GHOST_TSuccess GHOST_SystemWin32::getModifierKeys ( GHOST_ModifierKeys keys) const
virtual

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 461 of file GHOST_SystemWin32.cpp.

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

◆ getNumDisplays()

uint8_t GHOST_SystemWin32::getNumDisplays ( ) const
virtual

Returns the number of displays on this system.

Returns
The number of displays.

Implements GHOST_ISystem.

Definition at line 188 of file GHOST_SystemWin32.cpp.

References GHOST_DisplayManager::getNumDisplays(), GHOST_ASSERT, and GHOST_System::m_displayManager.

◆ handleKeyboardChange()

void GHOST_SystemWin32::handleKeyboardChange ( void  )
inlineprotected

Check current key layout for AltGr

Definition at line 485 of file GHOST_SystemWin32.h.

References m_hasAltGr, m_keylayout, and m_langId.

Referenced by GHOST_SystemWin32(), and s_wndProc().

◆ hardKey()

GHOST_TKey GHOST_SystemWin32::hardKey ( RAWINPUT const &  raw,
bool r_keyDown,
bool r_is_repeated_modifier 
)
protected

Catches raw WIN32 key codes from WM_INPUT in the wndproc.

Parameters
rawRawInput structure with detailed info about the key event.
keyDownPointer flag that specify if a key is down.
vkPointer to virtual key.
Returns
The GHOST key (GHOST_kKeyUnknown if no match).

Definition at line 560 of file GHOST_SystemWin32.cpp.

References convertKey(), GHOST_ModifierKeys::get(), GHOST_ISystem::getSystem(), GHOST_kKeyLeftAlt, GHOST_kKeyLeftControl, GHOST_kKeyLeftShift, GHOST_kKeyRightAlt, GHOST_kKeyRightControl, GHOST_kKeyRightShift, GHOST_kKeyUnknown, GHOST_kModifierKeyLeftAlt, GHOST_kModifierKeyLeftControl, GHOST_kModifierKeyLeftShift, GHOST_kModifierKeyRightAlt, GHOST_kModifierKeyRightControl, GHOST_kModifierKeyRightShift, usdtokens::raw(), retrieveModifierKeys(), GHOST_ModifierKeys::set(), and storeModifierKeys().

Referenced by processKeyEvent().

◆ init()

GHOST_TSuccess GHOST_SystemWin32::init ( )
protectedvirtual

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

Returns
A success value.

Reimplemented from GHOST_System.

Definition at line 505 of file GHOST_SystemWin32.cpp.

References GHOST_kFailure, GHOST_PRINT, GHOST_System::init(), initRawInput(), L, m_freq, m_hasPerformanceCounter, m_lfstart, m_start, NULL, 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 1370 of file GHOST_SystemWin32.cpp.

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 system process.

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

Definition at line 160 of file GHOST_SystemWin32.cpp.

References m_freq, m_start, and t.

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 870 of file GHOST_SystemWin32.cpp.

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

Referenced by s_wndProc().

◆ processCursorEvent()

GHOST_EventCursor * GHOST_SystemWin32::processCursorEvent ( GHOST_WindowWin32 window)
staticprotected

◆ processEvents()

bool GHOST_SystemWin32::processEvents ( bool  waitForEvent)
virtual

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 389 of file GHOST_SystemWin32.cpp.

References driveTrackpad(), GHOST_TimerManager::fireTimers(), getMilliSeconds(), GHOST_EventManager::getNumEvents(), GHOST_System::getTimerManager(), GHOST_kFireTimeNever, GHOST_System::m_eventManager, next, GHOST_TimerManager::nextFireTime(), NULL, 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 (m_modifierKeys). 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 1206 of file GHOST_SystemWin32.cpp.

References conv_utf_16_to_8(), getMilliSeconds(), GHOST_ISystem::getSystem(), GHOST_kEventKeyDown, GHOST_kEventKeyUp, hardKey(), m_keycode_last_repeat_key, m_keylayout, NULL, r, usdtokens::raw(), and state.

Referenced by s_wndProc().

◆ processMinMaxInfo()

void GHOST_SystemWin32::processMinMaxInfo ( MINMAXINFO *  minmax)
staticprotected

Handles minimum window size.

Parameters
minmaxThe MINMAXINFO structure.

Definition at line 1376 of file GHOST_SystemWin32.cpp.

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 1044 of file GHOST_SystemWin32.cpp.

References GHOST_WindowWin32::getPointerInfo(), GHOST_ISystem::getSystem(), GHOST_kEventButtonDown, GHOST_kEventButtonUp, GHOST_kEventCursorMove, GHOST_kSuccess, GHOST_kTabletWinPointer, MousePressed, MouseReleased, GHOST_System::pushEvent(), time, type, 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 T25715. This is going to be a long list T42426.

Definition at line 638 of file GHOST_SystemWin32.cpp.

References GHOST_kKeyAccentGrave, GHOST_kKeyF13, GHOST_kKeyNumpadPeriod, GHOST_kKeyQuote, GHOST_kKeySlash, GHOST_kKeyUnknown, and m_langId.

Referenced by convertKey().

◆ processTrackpad()

void GHOST_SystemWin32::processTrackpad ( )
protected

◆ processWheelEvent()

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

Handles a 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 1184 of file GHOST_SystemWin32.cpp.

References blender::math::abs(), getMilliSeconds(), GHOST_ISystem::getSystem(), m_wheelDeltaAccum, and GHOST_System::pushEvent().

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 1311 of file GHOST_SystemWin32.cpp.

References getMilliSeconds(), GHOST_ISystem::getSystem(), GHOST_System::getWindowManager(), GHOST_kEventWindowActivate, GHOST_WindowManager::setActiveWindow(), and type.

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 1294 of file GHOST_SystemWin32.cpp.

References GHOST_System::dispatchEvents(), getMilliSeconds(), GHOST_ISystem::getSystem(), GHOST_kEventWindowSize, GHOST_WindowWin32::m_inLiveResize, NULL, and GHOST_System::pushEvent().

Referenced by s_wndProc().

◆ processWintabEvent()

void GHOST_SystemWin32::processWintabEvent ( GHOST_WindowWin32 window)
staticprotected

◆ 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'n'drop event and pushes it immediately onto the event queue. Called by GHOST_DropTargetWin32 class.

Parameters
eventTypeThe type of drag'n'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 1333 of file GHOST_SystemWin32.cpp.

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

Referenced by GHOST_DropTargetWin32::DragEnter(), GHOST_DropTargetWin32::DragLeave(), GHOST_DropTargetWin32::DragOver(), and GHOST_DropTargetWin32::Drop().

◆ putClipboard()

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

Puts buffer to system clipboard.

Parameters
selectionUsed by X11 only.
Returns
No return.

Implements GHOST_System.

Definition at line 2236 of file GHOST_SystemWin32.cpp.

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

◆ retrieveModifierKeys()

void GHOST_SystemWin32::retrieveModifierKeys ( GHOST_ModifierKeys keys) const
inlineprotected

Returns the local state of the modifier keys (from the message queue).

Parameters
keysThe state of the keys.

Definition at line 475 of file GHOST_SystemWin32.h.

References m_modifierKeys.

Referenced by hardKey().

◆ 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 1493 of file GHOST_SystemWin32.cpp.

References GHOST_TabletData::Active, GHOST_ModifierKeys::clear(), GHOST_Wintab::disable(), GHOST_System::dispatchEvents(), GHOST_Wintab::enable(), GHOST_Wintab::gainFocus(), GET_POINTERID_WPARAM, 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, handleKeyboardChange(), L, GHOST_Wintab::leaveRange(), GHOST_WindowWin32::loadCursor(), GHOST_Wintab::loseFocus(), GHOST_WindowWin32::lostMouseCapture(), GHOST_WindowWin32::m_inLiveResize, m_keycode_last_repeat_key, GHOST_WindowWin32::m_mousePresent, GHOST_System::m_multitouchGestures, m_wheelDeltaAccum, NULL, GHOST_WindowWin32::onPointerHitTest(), processButtonEvent(), processCursorEvent(), GHOST_Wintab::processInfoChange(), processKeyEvent(), processMinMaxInfo(), processPointerEvent(), processWheelEvent(), processWindowEvent(), processWindowSizeEvent(), processWintabEvent(), GHOST_System::pushEvent(), usdtokens::raw(), GHOST_Wintab::remapCoordinates(), GHOST_EventManager::removeTypeEvents(), GHOST_WindowWin32::resetPointerPenInfo(), GHOST_WindowWin32::setState(), storeModifierKeys(), GHOST_WindowWin32::ThemeRefresh(), UINT(), GHOST_Wintab::updateCursorInfo(), GHOST_WindowWin32::updateDPI(), GHOST_WindowWin32::usingTabletAPI(), and WINTAB_PRINTF.

Referenced by init().

◆ setConsoleWindowState()

int GHOST_SystemWin32::setConsoleWindowState ( GHOST_TConsoleWindowState  action)
protectedvirtual

Set the Console State

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

Implements GHOST_ISystem.

Definition at line 2377 of file GHOST_SystemWin32.cpp.

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

Referenced by ~GHOST_SystemWin32().

◆ setCursorPosition()

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

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 454 of file GHOST_SystemWin32.cpp.

References GHOST_kFailure, GHOST_kSuccess, x, and y.

Referenced by processCursorEvent().

◆ setTabletAPI()

void GHOST_SystemWin32::setTabletAPI ( GHOST_TTabletAPI  api)
overridevirtual

◆ 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
virtual

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 2266 of file GHOST_SystemWin32.cpp.

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

◆ storeModifierKeys()

void GHOST_SystemWin32::storeModifierKeys ( const GHOST_ModifierKeys keys)
inlineprotected

Stores the state of the modifier keys locally. For internal use only! param keys The new state of the modifier keys.

Definition at line 480 of file GHOST_SystemWin32.h.

References m_modifierKeys.

Referenced by hardKey(), and s_wndProc().

◆ tickCountToMillis()

uint64_t GHOST_SystemWin32::tickCountToMillis ( __int64  ticks) const

This method converts system ticks into milliseconds since the start of the system process.

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

Definition at line 169 of file GHOST_SystemWin32.cpp.

References m_lfstart.

Referenced by getMilliSeconds().

Member Data Documentation

◆ m_consoleStatus

int GHOST_SystemWin32::m_consoleStatus
protected

Console status.

Definition at line 469 of file GHOST_SystemWin32.h.

Referenced by GHOST_SystemWin32(), and setConsoleWindowState().

◆ m_freq

__int64 GHOST_SystemWin32::m_freq
protected

High frequency timer variable.

Definition at line 456 of file GHOST_SystemWin32.h.

Referenced by init(), and performanceCounterToMillis().

◆ m_hasAltGr

bool GHOST_SystemWin32::m_hasAltGr
protected

AltGr on current keyboard layout.

Definition at line 462 of file GHOST_SystemWin32.h.

Referenced by handleKeyboardChange().

◆ m_hasPerformanceCounter

bool GHOST_SystemWin32::m_hasPerformanceCounter
protected

State variable set at initialization.

Definition at line 454 of file GHOST_SystemWin32.h.

Referenced by getMilliSeconds(), and init().

◆ m_keycode_last_repeat_key

unsigned short GHOST_SystemWin32::m_keycode_last_repeat_key
protected

The virtual-key code (VKey) of the last press event. Used to detect repeat events.

Definition at line 452 of file GHOST_SystemWin32.h.

Referenced by processKeyEvent(), and s_wndProc().

◆ m_keylayout

HKL GHOST_SystemWin32::m_keylayout
protected

Stores keyboard layout.

Definition at line 466 of file GHOST_SystemWin32.h.

Referenced by handleKeyboardChange(), and processKeyEvent().

◆ m_langId

WORD GHOST_SystemWin32::m_langId
protected

Language identifier.

Definition at line 464 of file GHOST_SystemWin32.h.

Referenced by handleKeyboardChange(), and processSpecialKey().

◆ m_lfstart

__int64 GHOST_SystemWin32::m_lfstart
protected

Low frequency timer variable.

Definition at line 460 of file GHOST_SystemWin32.h.

Referenced by init(), and tickCountToMillis().

◆ m_modifierKeys

GHOST_ModifierKeys GHOST_SystemWin32::m_modifierKeys
protected

The current state of the modifier keys.

Definition at line 450 of file GHOST_SystemWin32.h.

Referenced by retrieveModifierKeys(), and storeModifierKeys().

◆ m_start

__int64 GHOST_SystemWin32::m_start
protected

High frequency timer variable.

Definition at line 458 of file GHOST_SystemWin32.h.

Referenced by init(), and performanceCounterToMillis().

◆ m_wheelDeltaAccum

int GHOST_SystemWin32::m_wheelDeltaAccum
protected

Wheel delta accumulator.

Definition at line 472 of file GHOST_SystemWin32.h.

Referenced by processWheelEvent(), and s_wndProc().


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