ui: Add build version and debug indicator to window title bar

This commit is contained in:
Matt Borgerson 2020-12-24 15:37:53 -07:00 committed by mborgerson
parent 1b5e97e37f
commit 263870a7c3
2 changed files with 10 additions and 5 deletions

View File

@ -99,7 +99,7 @@ do
shift shift
;; ;;
'--debug') '--debug')
build_cflags='-O0 -g' build_cflags='-O0 -g -DXEMU_DEBUG_BUILD=1'
debug_opts='--enable-debug' debug_opts='--enable-debug'
shift shift
;; ;;

View File

@ -46,6 +46,7 @@
#include "xemu-input.h" #include "xemu-input.h"
#include "xemu-settings.h" #include "xemu-settings.h"
#include "xemu-shaders.h" #include "xemu-shaders.h"
#include "xemu-version.h"
#include "hw/xbox/smbus.h" // For eject, drive tray #include "hw/xbox/smbus.h" // For eject, drive tray
#include "hw/xbox/nv2a/nv2a.h" #include "hw/xbox/nv2a/nv2a.h"
@ -804,18 +805,22 @@ static void sdl2_display_very_early_init(DisplayOptions *o)
SDL_GL_CONTEXT_PROFILE_CORE); SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
char *title = g_strdup_printf("xemu | v%s"
#if XEMU_DEBUG_BUILD
" Debug"
#endif
, xemu_version);
// Create main window // Create main window
m_window = SDL_CreateWindow( m_window = SDL_CreateWindow(
"xemu", title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1024, 768,
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
1024, 768,
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
if (m_window == NULL) { if (m_window == NULL) {
fprintf(stderr, "Failed to create main window\n"); fprintf(stderr, "Failed to create main window\n");
SDL_Quit(); SDL_Quit();
exit(1); exit(1);
} }
g_free(title);
m_context = SDL_GL_CreateContext(m_window); m_context = SDL_GL_CreateContext(m_window);
assert(m_context != NULL); assert(m_context != NULL);