Updated resize changes and removed unneeded function.

This commit is contained in:
waltje
2017-11-11 16:02:13 -05:00
parent 62917eb6f1
commit bda698f975
3 changed files with 50 additions and 58 deletions

View File

@@ -8,7 +8,7 @@
*
* Define the various platform support functions.
*
* Version: @(#)plat.h 1.0.16 2017/10/28
* Version: @(#)plat.h 1.0.17 2017/11/11
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -83,14 +83,13 @@ extern void plat_mouse_capture(int on);
extern int plat_vidapi(char *name);
extern char *plat_vidapi_name(int api);
extern int plat_setvid(int api);
extern void plat_vidsize(int x, int y);
extern void plat_setfullscreen(int on);
extern void plat_vid_api_resize(int x, int y);
extern void plat_resize(int max_x, int max_y);
extern void plat_resize(int x, int y);
/* Resource management. */
extern wchar_t *plat_get_string(int id);
extern wchar_t *plat_get_string_from_string(char *str);
/* Platform-specific device support. */

View File

@@ -8,7 +8,7 @@
*
* Platform main support module for Windows.
*
* Version: @(#)win.c 1.0.33 2017/11/11
* Version: @(#)win.c 1.0.34 2017/11/11
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -624,7 +624,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE);
plat_vid_api_resize(scrnsz_x, scrnsz_y);
plat_vidsize(scrnsz_x, scrnsz_y);
MoveWindow(hwndSBAR, 0, scrnsz_y + 6, scrnsz_x, 17, TRUE);
@@ -1369,10 +1369,38 @@ plat_get_string(int i)
}
wchar_t *
plat_get_string_from_string(char *str)
/* Tell the UI about a new screen resolution. */
void
plat_resize(int x, int y)
{
return(plat_get_string(atoi(str)));
int sb_borders[3];
RECT r;
#if 0
pclog("PLAT: VID[%d,%d] resizing to %dx%d\n", video_fullscreen, vid_api, x, y);
#endif
/* First, see if we should resize the UI window. */
if (!vid_resize) {
video_wait_for_blit();
SendMessage(hwndSBAR, SB_GETBORDERS, 0, (LPARAM) sb_borders);
GetWindowRect(hwndMain, &r);
MoveWindow(hwndRender, 0, 0, x, y, TRUE);
GetWindowRect(hwndRender, &r);
MoveWindow(hwndSBAR,
0, r.bottom + GetSystemMetrics(SM_CYEDGE),
x, 17, TRUE);
GetWindowRect(hwndMain, &r);
MoveWindow(hwndMain, r.left, r.top,
x + (GetSystemMetrics(vid_resize ? SM_CXSIZEFRAME : SM_CXFIXEDFRAME) * 2),
y + (GetSystemMetrics(SM_CYEDGE) * 2) + (GetSystemMetrics(vid_resize ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 17 + sb_borders[1] + 1,
TRUE);
if (mouse_capture) {
GetWindowRect(hwndRender, &r);
ClipCursor(&r);
}
}
}

View File

@@ -8,7 +8,7 @@
*
* Platform video API support for Win32.
*
* Version: @(#)win_video.c 1.0.4 2017/10/28
* Version: @(#)win_video.c 1.0.5 2017/11/11
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*
@@ -180,6 +180,19 @@ plat_setvid(int api)
}
/* Tell the renderers about a new screen resolution. */
void
plat_vidsize(int x, int y)
{
if (! vid_apis[video_fullscreen][vid_api].resize) return;
startblit();
video_wait_for_blit();
vid_apis[video_fullscreen][vid_api].resize(x, y);
endblit();
}
int
get_vidpause(void)
{
@@ -301,51 +314,3 @@ endblit(void)
{
ReleaseMutex(ghMutex);
}
void
plat_vid_api_resize(int x, int y)
{
if (vid_apis[video_fullscreen][vid_api].resize)
{
startblit();
video_wait_for_blit();
vid_apis[video_fullscreen][vid_api].resize(x, y);
endblit();
}
}
/* Tell the UI and/or renderers about a new screen resolution. */
void
plat_resize(int x, int y)
{
int sb_borders[3];
RECT r;
#if 0
pclog("PLAT: VID[%d,%d] resizing to %dx%d\n", video_fullscreen, vid_api, x, y);
#endif
/* First, see if we should resize the UI window. */
if (!vid_resize) {
video_wait_for_blit();
SendMessage(hwndSBAR, SB_GETBORDERS, 0, (LPARAM) sb_borders);
GetWindowRect(hwndMain, &r);
MoveWindow(hwndRender, 0, 0, x, y, TRUE);
GetWindowRect(hwndRender, &r);
MoveWindow(hwndSBAR,
0, r.bottom + GetSystemMetrics(SM_CYEDGE),
x, 17, TRUE);
GetWindowRect(hwndMain, &r);
MoveWindow(hwndMain, r.left, r.top,
x + (GetSystemMetrics(vid_resize ? SM_CXSIZEFRAME : SM_CXFIXEDFRAME) * 2),
y + (GetSystemMetrics(SM_CYEDGE) * 2) + (GetSystemMetrics(vid_resize ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 17 + sb_borders[1] + 1,
TRUE);
if (mouse_capture) {
GetWindowRect(hwndRender, &r);
ClipCursor(&r);
}
}
}