engine: platform: move Host_Minimize_f into platform code

This commit is contained in:
Alibek Omarov
2025-05-11 15:17:04 +03:00
parent a479099804
commit 6ccafbe297
6 changed files with 23 additions and 12 deletions

View File

@@ -14,9 +14,6 @@ GNU General Public License for more details.
*/
#include "build.h"
#ifdef XASH_SDL
#include <SDL.h>
#endif // XASH_SDL
#include <stdarg.h> // va_args
#if !XASH_WIN32
#include <unistd.h> // fork
@@ -542,13 +539,6 @@ static void Host_MemStats_f( void )
}
}
static void Host_Minimize_f( void )
{
#ifdef XASH_SDL
if( host.hWnd ) SDL_MinimizeWindow( host.hWnd );
#endif
}
/*
=================
Host_RegisterDecal
@@ -1279,7 +1269,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
Cmd_AddRestrictedCommand( "quit", Sys_Quit_f, "quit the game" );
Cmd_AddRestrictedCommand( "exit", Sys_Quit_f, "quit the game" );
}
else Cmd_AddRestrictedCommand( "minimize", Host_Minimize_f, "minimize main window to tray" );
else Cmd_AddRestrictedCommand( "minimize", Platform_Minimize_f, "minimize main window to tray" );
host.errorframe = 0;

View File

@@ -27,6 +27,11 @@ GNU General Public License for more details.
#include <string.h>
#include <stdlib.h>
void Platform_Minimize_f( void )
{
// stub
}
/*
========================
Android_SwapBuffers

View File

@@ -28,6 +28,11 @@ struct fb_s
#define DEFAULT_FBDEV "/dev/fb0"
void Platform_Minimize_f( void )
{
// stub
}
/*
========================
Android_SwapBuffers

View File

@@ -257,7 +257,6 @@ void Platform_SetClipboardText( const char *buffer );
#if XASH_SDL == 1
#define SDL_SetWindowGrab( wnd, state ) SDL_WM_GrabInput( (state) ? SDL_GRAB_ON : SDL_GRAB_OFF )
#define SDL_GetWindowGrab( wnd ) ( SDL_WM_GrabInput( SDL_GRAB_QUERY ) != SDL_GRAB_OFF )
#define SDL_MinimizeWindow( wnd ) SDL_WM_IconifyWindow()
#define SDL_IsTextInputActive() host.textmode
#endif
@@ -311,6 +310,7 @@ void GL_SwapBuffers( void );
void *SW_LockBuffer( void );
void SW_UnlockBuffer( void );
qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b );
void Platform_Minimize_f( void );
//

View File

@@ -33,6 +33,11 @@ struct
SDL_Surface *win;
} sw;
void Platform_Minimize_f( void )
{
SDL_WM_IconifyWindow();
}
qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b )
{
sw.width = width;

View File

@@ -35,6 +35,12 @@ struct
SDL_Surface *win;
} sw;
void Platform_Minimize_f( void )
{
if( host.hWnd )
SDL_MinimizeWindow( host.hWnd );
}
qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b )
{
sw.width = width;