Blender V5.0
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_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 uintgetClipboardImageFilepath (int *r_width, int *r_height)
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 101 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 70 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_BACK_SLASH

#define VK_BACK_SLASH   0xDC

Definition at line 76 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_CLOSE_BRACKET

#define VK_CLOSE_BRACKET   0xDD

Definition at line 85 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_COMMA

#define VK_COMMA   0xBC

Definition at line 67 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_EQUALS

#define VK_EQUALS   0xBB

Definition at line 79 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_GR_LESS

#define VK_GR_LESS   0xE2

Definition at line 88 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_MINUS

#define VK_MINUS   0xBD

Definition at line 58 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_OPEN_BRACKET

#define VK_OPEN_BRACKET   0xDB

Definition at line 82 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_PERIOD

#define VK_PERIOD   0xBE

Definition at line 64 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_SEMICOLON

#define VK_SEMICOLON   0xBA

Definition at line 61 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::convertKey().

◆ VK_SLASH

#define VK_SLASH   0xBF

Definition at line 73 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 163 of file GHOST_SystemWin32.cc.

Function Documentation

◆ getClipboardImageDibV5()

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

Definition at line 2581 of file GHOST_SystemWin32.cc.

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

Referenced by GHOST_SystemWin32::getClipboardImage().

◆ getClipboardImageFilepath()

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

◆ getClipboardImageImBuf()

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

◆ getMessageTime()

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 232 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::processWheelEventHorizontal(), GHOST_SystemWin32::processWheelEventVertical(), GHOST_SystemWin32::processWindowEvent(), GHOST_SystemWin32::processWindowSizeEvent(), GHOST_SystemWin32::processWintabEvent(), and GHOST_SystemWin32::pushDragDropEvent().

◆ GetParentProcessID()

DWORD GetParentProcessID ( void )
static

Definition at line 2892 of file GHOST_SystemWin32.cc.

Referenced by isStartedFromCommandPrompt().

◆ getProcessName()

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

Definition at line 2916 of file GHOST_SystemWin32.cc.

References FALSE, and result.

Referenced by isStartedFromCommandPrompt().

◆ initRawInput()

void initRawInput ( )
static

Definition at line 132 of file GHOST_SystemWin32.cc.

References DEVICE_COUNT, and GHOST_PRINTF.

Referenced by GHOST_SystemWin32::init().

◆ isStartedFromCommandPrompt()

bool isStartedFromCommandPrompt ( )
static

◆ putClipboardImageDibV5()

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

Definition at line 2736 of file GHOST_SystemWin32.cc.

Referenced by GHOST_SystemWin32::putClipboardImage().

◆ putClipboardImagePNG()

◆ translateLongButtonToNDOFButton()

GHOST_NDOF_ButtonT translateLongButtonToNDOFButton ( uint16_t longKey)
static

Definition at line 123 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 110 of file GHOST_SystemWin32.cc.

Referenced by translateLongButtonToNDOFButton().