Skip to content

Commit

Permalink
add hack for linux to enforce minimum window size
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Oct 5, 2024
1 parent a93d004 commit 747f1df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions inc/wndproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#define WM_RESTORE_STYLE WM_APP+119

#define IDT_TIMER_LEAVE_BNET 541287654
#define IDT_TIMER_LINUX_FIX_WINDOW_SIZE 345267753

#define CNC_DDRAW_SET_FULLSCREEN 1
#define CNC_DDRAW_SET_WINDOWED 2
Expand Down
11 changes: 11 additions & 0 deletions src/wndproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam

return 0;
}
case IDT_TIMER_LINUX_FIX_WINDOW_SIZE:
{
KillTimer(g_ddraw.hwnd, IDT_TIMER_LINUX_FIX_WINDOW_SIZE);
util_set_window_rect(0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
return 0;
}
}
break;
}
Expand Down Expand Up @@ -471,6 +477,11 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
g_config.window_rect.bottom = height;

dd_SetDisplayMode(0, 0, 0, 0);

if (width < g_ddraw.width || height < g_ddraw.height)
{
SetTimer(g_ddraw.hwnd, IDT_TIMER_LINUX_FIX_WINDOW_SIZE, 1000, (TIMERPROC)NULL);
}
}
}
}
Expand Down

0 comments on commit 747f1df

Please sign in to comment.