Monado OpenXR Runtime
comp_window_mswin.c File Reference

Microsoft Windows window code. More...

#include <stdlib.h>
#include <string.h>
#include "xrt/xrt_compiler.h"
#include "main/comp_window.h"
#include "util/u_misc.h"
#include "os/os_threading.h"
Include dependency graph for comp_window_mswin.c:

Data Structures

struct  comp_window_mswin
 A Microsoft Windows window. More...
 

Macros

#define COMP_ERROR_GETLASTERROR(C, MSG_WITH_PLACEHOLDER, MSG_WITHOUT_PLACEHOLDER)
 

Functions

static void draw_window (HWND hWnd, struct comp_window_mswin *cwm)
 
static LRESULT CALLBACK WndProc (HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam)
 
static struct vk_bundleget_vk (struct comp_window_mswin *cwm)
 
static void comp_window_mswin_destroy (struct comp_target *ct)
 
static void comp_window_mswin_update_window_title (struct comp_target *ct, const char *title)
 
static void comp_window_mswin_fullscreen (struct comp_window_mswin *w)
 
static VkResult comp_window_mswin_create_surface (struct comp_window_mswin *w, VkSurfaceKHR *out_surface)
 
static bool comp_window_mswin_init_swapchain (struct comp_target *ct, uint32_t width, uint32_t height)
 
static void comp_window_mswin_flush (struct comp_target *ct)
 
static void comp_window_mswin_window_loop (struct comp_window_mswin *cwm)
 
static void comp_window_mswin_mark_exited (struct comp_window_mswin *cwm)
 
static void comp_window_mswin_thread (struct comp_window_mswin *cwm)
 
static void * comp_window_mswin_thread_func (void *ptr)
 
static bool comp_window_mswin_init (struct comp_target *ct)
 
static void comp_window_mswin_configure (struct comp_window_mswin *w, int32_t width, int32_t height)
 
struct comp_targetcomp_window_mswin_create (struct comp_compositor *c)
 
static bool detect (const struct comp_target_factory *ctf, struct comp_compositor *c)
 
static bool create_target (const struct comp_target_factory *ctf, struct comp_compositor *c, struct comp_target **out_ct)
 

Variables

static WCHAR szWindowClass [] = L"Monado"
 
static WCHAR szWindowData [] = L"MonadoWindow"
 
static const char * instance_extensions []
 
const struct comp_target_factory comp_target_factory_mswin
 

Detailed Description

Macro Definition Documentation

◆ COMP_ERROR_GETLASTERROR

#define COMP_ERROR_GETLASTERROR (   C,
  MSG_WITH_PLACEHOLDER,
  MSG_WITHOUT_PLACEHOLDER 
)
Value:
do { \
DWORD err = GetLastError(); \
char *buf = NULL; \
if (0 != FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, \
LANG_SYSTEM_DEFAULT, (LPSTR)&buf, 256, NULL)) { \
COMP_ERROR(C, MSG_WITH_PLACEHOLDER, buf); \
LocalFree(buf); \
} else { \
COMP_ERROR(C, MSG_WITHOUT_PLACEHOLDER); \
} \
} while (0)
#define C(c)
If COND is not VK_SUCCESS returns false.
Definition: comp_mirror_to_debug_gui.c:25

Function Documentation

◆ comp_window_mswin_destroy()

static void comp_window_mswin_destroy ( struct comp_target ct)
static

◆ comp_window_mswin_fullscreen()

static void comp_window_mswin_fullscreen ( struct comp_window_mswin w)
static

◆ comp_window_mswin_init_swapchain()

static bool comp_window_mswin_init_swapchain ( struct comp_target ct,
uint32_t  width,
uint32_t  height 
)
static

◆ comp_window_mswin_thread()

static void comp_window_mswin_thread ( struct comp_window_mswin cwm)
static

◆ comp_window_mswin_update_window_title()

static void comp_window_mswin_update_window_title ( struct comp_target ct,
const char *  title 
)
static

Variable Documentation

◆ comp_target_factory_mswin

const struct comp_target_factory comp_target_factory_mswin
Initial value:
= {
.name = "Microsoft Windows(TM)",
.identifier = "mswin",
.requires_vulkan_for_create = false,
.is_deferred = true,
.required_instance_version = 0,
.required_instance_extensions = instance_extensions,
.required_instance_extension_count = ARRAY_SIZE(instance_extensions),
.optional_device_extensions = NULL,
.optional_device_extension_count = 0,
.detect = detect,
.create_target = create_target,
}
#define ARRAY_SIZE(a)
Array size helper.
Definition: xrt_compiler.h:30

◆ instance_extensions

const char* instance_extensions[]
static
Initial value:
= {
VK_KHR_WIN32_SURFACE_EXTENSION_NAME,
}