(D3D) Use the same hwnd variable as WGL

This commit is contained in:
twinaphex 2015-11-12 02:45:16 +01:00
parent 66727bba2e
commit cb008b13f8
4 changed files with 17 additions and 18 deletions

View File

@ -225,7 +225,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
if (!strcmp(video_driver, "d3d"))
{
d3d_video_t *d3d = (d3d_video_t*)driver->video_data;
d3dr = d3d->hWnd;
d3dr = g_hwnd;
}
LRESULT ret = win32_menu_loop(d3dr, wparam);
(void)ret;

View File

@ -161,7 +161,7 @@ void d3d_make_d3dpp(void *data,
#endif
info->rgb32 ? D3DFMT_X8R8G8B8 : D3DFMT_LIN_R5G6B5;
#else
d3dpp->hDeviceWindow = d3d->hWnd;
d3dpp->hDeviceWindow = g_hwnd;
d3dpp->BackBufferFormat = !d3dpp->Windowed ? D3DFMT_X8R8G8B8 : D3DFMT_UNKNOWN;
#endif
@ -247,7 +247,7 @@ static bool d3d_init_base(void *data, const video_info_t *info)
if (FAILED(d3d->d3d_err = d3d->g_pD3D->CreateDevice(
d3d->cur_mon_id,
D3DDEVTYPE_HAL,
d3d->hWnd,
g_hwnd,
D3DCREATE_HARDWARE_VERTEXPROCESSING,
&d3dpp,
&d3d->dev)))
@ -258,7 +258,7 @@ static bool d3d_init_base(void *data, const video_info_t *info)
if (FAILED(d3d->d3d_err = d3d->g_pD3D->CreateDevice(
d3d->cur_mon_id,
D3DDEVTYPE_HAL,
d3d->hWnd,
g_hwnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp,
&d3d->dev)))
@ -667,7 +667,7 @@ static bool d3d_construct(d3d_video_t *d3d,
win_height = rect.bottom - rect.top;
}
d3d->hWnd = CreateWindowEx(0, "RetroArch", "RetroArch",
g_hwnd = CreateWindowEx(0, "RetroArch", "RetroArch",
style,
info->fullscreen ? mon_rect.left : CW_USEDEFAULT,
info->fullscreen ? mon_rect.top : CW_USEDEFAULT,
@ -676,7 +676,7 @@ static bool d3d_construct(d3d_video_t *d3d,
driver->display_type = RARCH_DISPLAY_WIN32;
driver->video_display = 0;
driver->video_window = (uintptr_t)d3d->hWnd;
driver->video_window = (uintptr_t)g_hwnd;
#endif
#endif
@ -696,16 +696,16 @@ static bool d3d_construct(d3d_video_t *d3d,
{
RECT rc_temp = {0, 0, (LONG)win_height, 0x7FFF};
SetMenu(d3d->hWnd, LoadMenu(GetModuleHandle(NULL),MAKEINTRESOURCE(IDR_MENU)));
SendMessage(d3d->hWnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rc_temp);
SetMenu(g_hwnd, LoadMenu(GetModuleHandle(NULL),MAKEINTRESOURCE(IDR_MENU)));
SendMessage(g_hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rc_temp);
win_height += rc_temp.top + rect.top;
SetWindowPos(d3d->hWnd, NULL, 0, 0, win_width, win_height, SWP_NOMOVE);
SetWindowPos(g_hwnd, NULL, 0, 0, win_width, win_height, SWP_NOMOVE);
}
ShowWindow(d3d->hWnd, SW_RESTORE);
UpdateWindow(d3d->hWnd);
SetForegroundWindow(d3d->hWnd);
SetFocus(d3d->hWnd);
ShowWindow(g_hwnd, SW_RESTORE);
UpdateWindow(g_hwnd);
SetForegroundWindow(g_hwnd);
SetFocus(g_hwnd);
}
#endif
@ -890,7 +890,7 @@ static void d3d_free(void *data)
d3d->g_pD3D->Release();
#ifdef HAVE_MONITOR
win32_monitor_from_window(d3d->hWnd, true);
win32_monitor_from_window(g_hwnd, true);
#endif
if (d3d)
@ -1528,7 +1528,7 @@ static bool d3d_frame(void *data, const void *frame,
#ifndef _XBOX
/* We cannot recover in fullscreen. */
if (d3d->needs_restore && IsIconic(d3d->hWnd))
if (d3d->needs_restore && IsIconic(g_hwnd))
return true;
#endif
if (d3d->needs_restore && !d3d_restore(d3d))

View File

@ -99,7 +99,6 @@ typedef struct d3d_video
struct video_viewport vp;
WNDCLASSEX windowClass;
HWND hWnd;
LPDIRECT3D g_pD3D;
LPDIRECT3DDEVICE dev;
HRESULT d3d_err;

View File

@ -91,7 +91,7 @@ static void gfx_ctx_d3d_update_title(void *data)
#ifndef _XBOX
d3d_video_t *d3d = (d3d_video_t*)data;
SetWindowText(d3d->hWnd, buf);
SetWindowText(g_hwnd, buf);
#endif
}
@ -138,7 +138,7 @@ static bool gfx_ctx_d3d_has_focus(void *data)
d3d_video_t *d3d = (d3d_video_t*)data;
if (!d3d)
return false;
return GetFocus() == d3d->hWnd;
return GetFocus() == g_hwnd;
}
static bool gfx_ctx_d3d_suppress_screensaver(void *data, bool enable)