Blender V4.3
GHOST_SystemWin32.cc File Reference
#include <limits>
#include <map>
#include "GHOST_EventDragnDrop.hh"
#include "GHOST_EventTrackpad.hh"
#include "GHOST_SystemWin32.hh"
#include <commctrl.h>
#include <dwmapi.h>
#include <psapi.h>
#include <shellapi.h>
#include <shellscalingapi.h>
#include <shlobj.h>
#include <tlhelp32.h>
#include <windowsx.h>
#include "utf_winfunc.hh"
#include "utfconv.hh"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "GHOST_DisplayManagerWin32.hh"
#include "GHOST_EventButton.hh"
#include "GHOST_EventCursor.hh"
#include "GHOST_EventKey.hh"
#include "GHOST_EventWheel.hh"
#include "GHOST_TimerManager.hh"
#include "GHOST_TimerTask.hh"
#include "GHOST_WindowManager.hh"
#include "GHOST_WindowWin32.hh"
#include "GHOST_ContextD3D.hh"

Go to the source code of this file.

Macros

#define _WIN32_IE   0x0501 /* shipped before XP, so doesn't impose additional requirements */
 
#define VK_MINUS   0xBD
 
#define VK_SEMICOLON   0xBA
 
#define VK_PERIOD   0xBE
 
#define VK_COMMA   0xBC
 
#define VK_BACK_QUOTE   0xC0
 
#define VK_SLASH   0xBF
 
#define VK_BACK_SLASH   0xDC
 
#define VK_EQUALS   0xBB
 
#define VK_OPEN_BRACKET   0xDB
 
#define VK_CLOSE_BRACKET   0xDD
 
#define VK_GR_LESS   0xE2
 
#define BROKEN_PEEK_TOUCHPAD
 
#define DEVICE_COUNT   1
 

Typedefs

typedef BOOL(API * GHOST_WIN32_EnableNonClientDpiScaling) (HWND)
 

Functions

static bool isStartedFromCommandPrompt ()
 
static GHOST_NDOF_ButtonT translateLongButtonToNDOFButton (uint16_t longKey)
 
static void initRawInput ()
 
static uint64_t getMessageTime (GHOST_SystemWin32 *system)
 
static uintgetClipboardImageDibV5 (int *r_width, int *r_height)
 
static uintgetClipboardImageImBuf (int *r_width, int *r_height, UINT format)
 
static bool putClipboardImageDibV5 (uint *rgba, int width, int height)
 
static bool putClipboardImagePNG (uint *rgba, int width, int height)
 
static DWORD GetParentProcessID (void)
 
static bool getProcessName (int pid, char *buffer, int max_len)
 

Variables

static const std::map< uint16_t, GHOST_NDOF_ButtonTlongButtonHIDsToGHOST_NDOFButtons
 

Macro Definition Documentation

◆ _WIN32_IE

#define _WIN32_IE   0x0501 /* shipped before XP, so doesn't impose additional requirements */

Definition at line 17 of file GHOST_SystemWin32.cc.

◆ BROKEN_PEEK_TOUCHPAD

#define BROKEN_PEEK_TOUCHPAD

Workaround for some laptop touch-pads, some of which seems to have driver issues which makes it so window function receives the message, but #PeekMessage doesn't pick those messages for some reason.

We send a dummy WM_USER message to force #PeekMessage to receive something, making it so blender's window manager sees the new messages coming in.

Definition at line 102 of file GHOST_SystemWin32.cc.

◆ DEVICE_COUNT

#define DEVICE_COUNT   1

Referenced by initRawInput().

◆ VK_BACK_QUOTE

#define VK_BACK_QUOTE   0xC0

Definition at line 71 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_BACK_SLASH

#define VK_BACK_SLASH   0xDC

Definition at line 77 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_CLOSE_BRACKET

#define VK_CLOSE_BRACKET   0xDD

Definition at line 86 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_COMMA

#define VK_COMMA   0xBC

Definition at line 68 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_EQUALS

#define VK_EQUALS   0xBB

Definition at line 80 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_GR_LESS

#define VK_GR_LESS   0xE2

Definition at line 89 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_MINUS

#define VK_MINUS   0xBD

Definition at line 59 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_OPEN_BRACKET

#define VK_OPEN_BRACKET   0xDB

Definition at line 83 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_PERIOD

#define VK_PERIOD   0xBE

Definition at line 65 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_SEMICOLON

#define VK_SEMICOLON   0xBA

Definition at line 62 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_SLASH

#define VK_SLASH   0xBF

Definition at line 74 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

Typedef Documentation

◆ GHOST_WIN32_EnableNonClientDpiScaling

typedef BOOL(API * GHOST_WIN32_EnableNonClientDpiScaling) (HWND)

Definition at line 164 of file GHOST_SystemWin32.cc.

Function Documentation

◆ getClipboardImageDibV5()

static uint * getClipboardImageDibV5 ( int * r_width,
int * r_height )
static

Definition at line 2407 of file GHOST_SystemWin32.cc.

References quad, triple(), and w().

Referenced by GHOST_SystemWin32::getClipboardImage().

◆ getClipboardImageImBuf()

static uint * getClipboardImageImBuf ( int * r_width,
int * r_height,
UINT format )
static

◆ getMessageTime()

static uint64_t getMessageTime ( GHOST_SystemWin32 * system)
static

Returns the message time, compatible with the time value from #getMilliSeconds. This should be used instead of #getMilliSeconds when you need the time a message was delivered versus collected, so for all event creation that are in response to receiving a Windows message.

Definition at line 233 of file GHOST_SystemWin32.cc.

References GHOST_SystemWin32::getMilliSeconds(), and UINT32_MAX.

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

◆ GetParentProcessID()

static DWORD GetParentProcessID ( void )
static

Definition at line 2714 of file GHOST_SystemWin32.cc.

Referenced by isStartedFromCommandPrompt().

◆ getProcessName()

static bool getProcessName ( int pid,
char * buffer,
int max_len )
static

Definition at line 2738 of file GHOST_SystemWin32.cc.

References FALSE, and result.

Referenced by isStartedFromCommandPrompt().

◆ initRawInput()

static void initRawInput ( )
static

Definition at line 133 of file GHOST_SystemWin32.cc.

References DEVICE_COUNT, and GHOST_PRINTF.

Referenced by GHOST_SystemWin32::init().

◆ isStartedFromCommandPrompt()

static bool isStartedFromCommandPrompt ( )
static

◆ putClipboardImageDibV5()

static bool putClipboardImageDibV5 ( uint * rgba,
int width,
int height )
static

Definition at line 2558 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::putClipboardImage().

◆ putClipboardImagePNG()

◆ translateLongButtonToNDOFButton()

static GHOST_NDOF_ButtonT translateLongButtonToNDOFButton ( uint16_t longKey)
static

Definition at line 124 of file GHOST_SystemWin32.cc.

References longButtonHIDsToGHOST_NDOFButtons.

Variable Documentation

◆ longButtonHIDsToGHOST_NDOFButtons

const std::map<uint16_t, GHOST_NDOF_ButtonT> longButtonHIDsToGHOST_NDOFButtons
static
Initial value:
= {
}
@ GHOST_NDOF_BUTTON_TILT_CCW
@ GHOST_NDOF_BUTTON_SAVE_V1
@ GHOST_NDOF_BUTTON_ROLL_CCW
@ GHOST_NDOF_BUTTON_BACK
@ GHOST_NDOF_BUTTON_ISO2
@ GHOST_NDOF_BUTTON_SPIN_CCW
@ GHOST_NDOF_BUTTON_SAVE_V3
@ GHOST_NDOF_BUTTON_SAVE_V2
@ GHOST_NDOF_BUTTON_BOTTOM
@ GHOST_NDOF_BUTTON_LEFT

SpaceMouse devices ship with an internal identifier number for each long press event. These values can be found in <3DxWare installation path>/3DxWinCore/Cfg/Base.xml. For input processing purposes these identifiers have to be mapped to particular button events.

Definition at line 111 of file GHOST_SystemWin32.cc.

Referenced by translateLongButtonToNDOFButton().