From 33520fca6f877b751971c63740597a5c5f2a8e1d Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Wed, 4 Jan 2017 23:13:08 -0500 Subject: [PATCH] set win32_hdc for gdi --- gfx/common/win32_common.cpp | 2 +- gfx/common/win32_common.h | 1 + gfx/drivers_context/gdi_ctx.cpp | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gfx/common/win32_common.cpp b/gfx/common/win32_common.cpp index d7f5607e53..05beed2ea6 100644 --- a/gfx/common/win32_common.cpp +++ b/gfx/common/win32_common.cpp @@ -542,7 +542,7 @@ LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message, ui_window_win32_t win32_window; win32_window.hwnd = hwnd; - g_inited = true; + create_gdi_context(hwnd, &g_quit); ui_window_win32_set_droppable(&win32_window, true); } diff --git a/gfx/common/win32_common.h b/gfx/common/win32_common.h index b1d7542f74..c35306a0c3 100644 --- a/gfx/common/win32_common.h +++ b/gfx/common/win32_common.h @@ -51,6 +51,7 @@ void win32_monitor_get_info(void); void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id); void create_graphics_context(HWND hwnd, bool *quit); +void create_gdi_context(HWND hwnd, bool *quit); bool win32_shader_dlg_init(void); void shader_dlg_show(HWND parent_hwnd); diff --git a/gfx/drivers_context/gdi_ctx.cpp b/gfx/drivers_context/gdi_ctx.cpp index 61a3b0973e..a71e63ab26 100644 --- a/gfx/drivers_context/gdi_ctx.cpp +++ b/gfx/drivers_context/gdi_ctx.cpp @@ -291,6 +291,13 @@ static void gfx_ctx_gdi_swap_buffers(void *data) (void)data; } +void create_gdi_context(HWND hwnd, bool *quit) +{ + (void)quit; + win32_hdc = GetDC(hwnd); + g_inited = true; +} + const gfx_ctx_driver_t gfx_ctx_gdi = { gfx_ctx_gdi_init, gfx_ctx_gdi_destroy,