summaryrefslogtreecommitdiffstats
path: root/src/libs/dxvk-native-1.9.2a/include/native/wsi/native_headless.h
blob: 7dab4cce66de366482db059a1000db2260a8a1cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <cstdint>
#include <windows.h>

namespace dxvk::wsi {

  inline void* fromHwnd(HWND hWindow) {
    return reinterpret_cast<void *>(hWindow);
  }

  inline HWND toHwnd(void* pWindow) {
    return reinterpret_cast<HWND>(pWindow);
  }

  // Offset so null HMONITORs go to -1
  inline int32_t fromHmonitor(HMONITOR hMonitor) {
    return static_cast<int32_t>(reinterpret_cast<intptr_t>(hMonitor)) - 1;
  }

  // Offset so -1 display id goes to 0 == NULL
  inline HMONITOR toHmonitor(int32_t displayId) {
    return reinterpret_cast<HMONITOR>(static_cast<intptr_t>(displayId + 1));
  }

}