Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_WindowWin32.h
| Show All 24 Lines | |||||
| #pragma once | #pragma once | ||||
| #ifndef WIN32 | #ifndef WIN32 | ||||
| # error WIN32 only! | # error WIN32 only! | ||||
| #endif // WIN32 | #endif // WIN32 | ||||
| #include "GHOST_TaskbarWin32.h" | #include "GHOST_TaskbarWin32.h" | ||||
| #include "GHOST_Window.h" | #include "GHOST_Window.h" | ||||
| #include "GHOST_Wintab.h" | |||||
| #ifdef WITH_INPUT_IME | #ifdef WITH_INPUT_IME | ||||
| # include "GHOST_ImeWin32.h" | # include "GHOST_ImeWin32.h" | ||||
| #endif | #endif | ||||
| #include <vector> | #include <vector> | ||||
| #include <wintab.h> | |||||
| // PACKETDATA and PACKETMODE modify structs in pktdef.h, so make sure they come first | |||||
| #define PACKETDATA (PK_BUTTONS | PK_NORMAL_PRESSURE | PK_ORIENTATION | PK_CURSOR) | |||||
| #define PACKETMODE PK_BUTTONS | |||||
| #include <pktdef.h> | |||||
| class GHOST_SystemWin32; | class GHOST_SystemWin32; | ||||
| class GHOST_DropTargetWin32; | class GHOST_DropTargetWin32; | ||||
| // typedefs for WinTab functions to allow dynamic loading | |||||
| typedef UINT(API *GHOST_WIN32_WTInfo)(UINT, UINT, LPVOID); | |||||
| typedef HCTX(API *GHOST_WIN32_WTOpen)(HWND, LPLOGCONTEXTA, BOOL); | |||||
| typedef BOOL(API *GHOST_WIN32_WTClose)(HCTX); | |||||
| typedef BOOL(API *GHOST_WIN32_WTPacket)(HCTX, UINT, LPVOID); | |||||
| typedef BOOL(API *GHOST_WIN32_WTEnable)(HCTX, BOOL); | |||||
| typedef BOOL(API *GHOST_WIN32_WTOverlap)(HCTX, BOOL); | |||||
| // typedefs for user32 functions to allow dynamic loading of Windows 10 DPI scaling functions | // typedefs for user32 functions to allow dynamic loading of Windows 10 DPI scaling functions | ||||
| typedef UINT(API *GHOST_WIN32_GetDpiForWindow)(HWND); | typedef UINT(API *GHOST_WIN32_GetDpiForWindow)(HWND); | ||||
| struct GHOST_PointerInfoWin32 { | struct GHOST_PointerInfoWin32 { | ||||
| GHOST_TInt32 pointerId; | GHOST_TInt32 pointerId; | ||||
| GHOST_TInt32 isPrimary; | GHOST_TInt32 isPrimary; | ||||
| GHOST_TButtonMask buttonMask; | GHOST_TButtonMask buttonMask; | ||||
| POINT pixelLocation; | POINT pixelLocation; | ||||
| GHOST_TUns64 time; | GHOST_TUns64 time; | ||||
| GHOST_TabletData tabletData; | GHOST_TabletData tabletData; | ||||
| }; | }; | ||||
| typedef enum { | typedef enum { | ||||
| MousePressed, | MousePressed, | ||||
| MouseReleased, | MouseReleased, | ||||
| OperatorGrab, | OperatorGrab, | ||||
| OperatorUngrab | OperatorUngrab | ||||
| ▲ Show 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | public: | ||||
| /** | /** | ||||
| * Loads the windows equivalent of a standard GHOST cursor. | * Loads the windows equivalent of a standard GHOST cursor. | ||||
| * \param visible: Flag for cursor visibility. | * \param visible: Flag for cursor visibility. | ||||
| * \param cursorShape: The cursor shape. | * \param cursorShape: The cursor shape. | ||||
| */ | */ | ||||
| HCURSOR getStandardCursor(GHOST_TStandardCursor shape) const; | HCURSOR getStandardCursor(GHOST_TStandardCursor shape) const; | ||||
| void loadCursor(bool visible, GHOST_TStandardCursor cursorShape) const; | void loadCursor(bool visible, GHOST_TStandardCursor cursorShape) const; | ||||
| const GHOST_TabletData &getTabletData() | |||||
| { | |||||
| return m_tabletData; | |||||
| } | |||||
| /** | /** | ||||
| * Query whether given tablet API should be used. | * Query whether given tablet API should be used. | ||||
| * \param api: Tablet API to test. | * \param api: Tablet API to test. | ||||
| */ | */ | ||||
| bool useTabletAPI(GHOST_TTabletAPI api) const; | bool useTabletAPI(GHOST_TTabletAPI api) const; | ||||
| /** | /** | ||||
| * Translate WM_POINTER events into GHOST_PointerInfoWin32 structs. | * Translate WM_POINTER events into GHOST_PointerInfoWin32 structs. | ||||
| * \param outPointerInfo: Storage to return resulting GHOST_PointerInfoWin32 structs. | * \param outPointerInfo: Storage to return resulting GHOST_PointerInfoWin32 structs. | ||||
| * \param wParam: WPARAM of the event. | * \param wParam: WPARAM of the event. | ||||
| * \param lParam: LPARAM of the event. | * \param lParam: LPARAM of the event. | ||||
| * \return True if #outPointerInfo was updated. | * \return True if #outPointerInfo was updated. | ||||
| */ | */ | ||||
| GHOST_TSuccess getPointerInfo(std::vector<GHOST_PointerInfoWin32> &outPointerInfo, | GHOST_TSuccess getPointerInfo(std::vector<GHOST_PointerInfoWin32> &outPointerInfo, | ||||
| WPARAM wParam, | WPARAM wParam, | ||||
| LPARAM lParam); | LPARAM lParam); | ||||
| void processWin32TabletActivateEvent(WORD state); | /** | ||||
| void processWin32TabletInitEvent(); | * Resets pointer pen tablet state. | ||||
| void processWin32TabletEvent(WPARAM wParam, LPARAM lParam); | */ | ||||
| void bringTabletContextToFront(); | void resetPointerPenInfo(); | ||||
| /** | |||||
| * Retrieves pointer to Wintab if Wintab is the set Tablet API. | |||||
| * \return Pointer to Wintab member. | |||||
| */ | |||||
| GHOST_Wintab *getWintab() const; | |||||
| /** | |||||
| * Loads Wintab context for the window. | |||||
| * \param enable: True if Wintab should be enabled after loading. Wintab should not be enabled if | |||||
| * the window is minimzed. | |||||
| */ | |||||
| void loadWintab(bool enable); | |||||
| /** | |||||
| * Closes Wintab for the window. | |||||
| */ | |||||
| void closeWintab(); | |||||
| /** | |||||
| * Get the most recent tablet data. | |||||
| * \return Most recent tablet data. | |||||
| */ | |||||
| GHOST_TabletData getTabletData(); | |||||
nicholas_rishel: Todo | |||||
| GHOST_TSuccess beginFullScreen() const | GHOST_TSuccess beginFullScreen() const | ||||
| { | { | ||||
| return GHOST_kFailure; | return GHOST_kFailure; | ||||
| } | } | ||||
| GHOST_TSuccess endFullScreen() const | GHOST_TSuccess endFullScreen() const | ||||
| { | { | ||||
| return GHOST_kFailure; | return GHOST_kFailure; | ||||
| } | } | ||||
| GHOST_TUns16 getDPIHint() override; | GHOST_TUns16 getDPIHint() override; | ||||
| /** Whether a tablet stylus is being tracked. */ | /** True if the mouse is either over or captured by the window. */ | ||||
| bool m_tabletInRange; | bool m_mousePresent; | ||||
| /** if the window currently resizing */ | /** True if the window currently resizing. */ | ||||
| bool m_inLiveResize; | bool m_inLiveResize; | ||||
| #ifdef WITH_INPUT_IME | #ifdef WITH_INPUT_IME | ||||
| GHOST_ImeWin32 *getImeInput() | GHOST_ImeWin32 *getImeInput() | ||||
| { | { | ||||
| return &m_imeInput; | return &m_imeInput; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | private: | ||||
| bool m_wantAlphaBackground; | bool m_wantAlphaBackground; | ||||
| /** ITaskbarList3 structure for progress bar. */ | /** ITaskbarList3 structure for progress bar. */ | ||||
| ITaskbarList3 *m_Bar; | ITaskbarList3 *m_Bar; | ||||
| static const wchar_t *s_windowClassName; | static const wchar_t *s_windowClassName; | ||||
| static const int s_maxTitleLength; | static const int s_maxTitleLength; | ||||
| /** Tablet data for GHOST */ | /** Pointer to Wintab manager if Wintab is loaded. */ | ||||
| GHOST_TabletData m_tabletData; | GHOST_Wintab *m_wintab; | ||||
| /* Wintab API */ | /** Most recent tablet data. */ | ||||
| struct { | GHOST_TabletData m_lastPointerTabletData; | ||||
| /** `WinTab.dll` handle. */ | |||||
| HMODULE handle = NULL; | |||||
| /** API functions */ | |||||
| GHOST_WIN32_WTInfo info; | |||||
| GHOST_WIN32_WTOpen open; | |||||
| GHOST_WIN32_WTClose close; | |||||
| GHOST_WIN32_WTPacket packet; | |||||
| GHOST_WIN32_WTEnable enable; | |||||
| GHOST_WIN32_WTOverlap overlap; | |||||
| /** Stores the Tablet context if detected Tablet features using `WinTab.dll` */ | |||||
| HCTX tablet; | |||||
| LONG maxPressure; | |||||
| LONG maxAzimuth, maxAltitude; | |||||
| } m_wintab; | |||||
| GHOST_TWindowState m_normal_state; | GHOST_TWindowState m_normal_state; | ||||
| /** `user32.dll` handle */ | /** `user32.dll` handle */ | ||||
| HMODULE m_user32; | HMODULE m_user32; | ||||
| HWND m_parentWindowHwnd; | HWND m_parentWindowHwnd; | ||||
| #ifdef WITH_INPUT_IME | #ifdef WITH_INPUT_IME | ||||
| /** Handle input method editors event */ | /** Handle input method editors event */ | ||||
| GHOST_ImeWin32 m_imeInput; | GHOST_ImeWin32 m_imeInput; | ||||
| #endif | #endif | ||||
| bool m_debug_context; | bool m_debug_context; | ||||
| }; | }; | ||||
Todo