Skip to content

Commit

Permalink
add partial support for menus in fullscreen via nonexclusive=true
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Apr 20, 2024
1 parent f735ef8 commit ec64866
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
19 changes: 15 additions & 4 deletions src/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
{
x = y = 0;

if (!g_config.remove_menu && GetMenu(g_ddraw.hwnd))
if (GetMenu(g_ddraw.hwnd))
{
y = real_GetSystemMetrics(SM_CYMENU);
}
Expand Down Expand Up @@ -972,8 +972,19 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
}
else
{
int menu_height = 0;

if (GetMenu(g_ddraw.hwnd))
SetMenu(g_ddraw.hwnd, NULL);
{
if (g_config.remove_menu || !g_config.nonexclusive)
{
SetMenu(g_ddraw.hwnd, NULL);
}
else
{
menu_height = real_GetSystemMetrics(SM_CYMENU);
}
}

LONG style = real_GetWindowLongA(g_ddraw.hwnd, GWL_STYLE);

Expand Down Expand Up @@ -1011,7 +1022,7 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
0,
0,
g_ddraw.render.width,
g_ddraw.render.height,
g_ddraw.render.height + menu_height,
swp_flags);

swp_flags = SWP_SHOWWINDOW;
Expand Down Expand Up @@ -1071,7 +1082,7 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
0,
0,
g_ddraw.render.width,
g_ddraw.render.height,
g_ddraw.render.height + menu_height,
swp_flags);

if (d3d9_active && g_config.nonexclusive)
Expand Down
6 changes: 4 additions & 2 deletions src/wndproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,15 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
{
g_ddraw.last_set_window_pos_tick = timeGetTime();

int menu_height = GetMenu(g_ddraw.hwnd) ? real_GetSystemMetrics(SM_CYMENU) : 0;

real_SetWindowPos(
g_ddraw.hwnd,
HWND_TOPMOST,
1,
1,
g_ddraw.render.width,
g_ddraw.render.height,
g_ddraw.render.height + menu_height,
SWP_SHOWWINDOW);

real_SetWindowPos(
Expand All @@ -259,7 +261,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
0,
0,
g_ddraw.render.width,
g_ddraw.render.height,
g_ddraw.render.height + menu_height,
SWP_SHOWWINDOW);
}
return 0;
Expand Down

0 comments on commit ec64866

Please sign in to comment.