From 27a021eb7cf25d404ea4bad208d52f886cb0fdb0 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sat, 10 Apr 2021 18:52:54 +0200 Subject: [PATCH] Port the client to the new restart API. This fixes the video menu and alt-tab when running a renderer that uses the new API. --- src/client/cl_keyboard.c | 4 ++-- src/client/menu/videomenu.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/client/cl_keyboard.c b/src/client/cl_keyboard.c index 7e90da94..aa33db32 100644 --- a/src/client/cl_keyboard.c +++ b/src/client/cl_keyboard.c @@ -1231,12 +1231,12 @@ Key_Event(int key, qboolean down, qboolean special) if (!fullscreen->value) { Cvar_Set("vid_fullscreen", "1"); - fullscreen->modified = true; + Cbuf_AddText("vid_restart\n"); } else { Cvar_Set("vid_fullscreen", "0"); - fullscreen->modified = true; + Cbuf_AddText("vid_restart\n"); } return; diff --git a/src/client/menu/videomenu.c b/src/client/menu/videomenu.c index bfabcea3..67b7081a 100644 --- a/src/client/menu/videomenu.c +++ b/src/client/menu/videomenu.c @@ -190,19 +190,19 @@ ApplyChanges(void *unused) if (!strcmp(s_mode_list.itemnames[s_mode_list.curvalue], AUTO_MODE_NAME)) { - /* Restarts automatically */ Cvar_SetValue("r_mode", -2); + restart = true; } else if (!strcmp(s_mode_list.itemnames[s_mode_list.curvalue], CUSTOM_MODE_NAME)) { - /* Restarts automatically */ Cvar_SetValue("r_mode", -1); + restart = true; } else { - /* Restarts automatically */ Cvar_SetValue("r_mode", s_mode_list.curvalue); + restart = true; } if (s_display_list.curvalue != GLimp_GetWindowDisplayIndex() ) @@ -229,7 +229,11 @@ ApplyChanges(void *unused) } /* Restarts automatically */ - Cvar_SetValue("vid_fullscreen", s_fs_box.curvalue); + if (vid_fullscreen->value != s_fs_box.curvalue) + { + Cvar_SetValue("vid_fullscreen", s_fs_box.curvalue); + restart = true; + } if (s_fs_box.curvalue == 2) {