From b0d2bf59a6c08f18e0cb0e4175bd2eaf65d48a10 Mon Sep 17 00:00:00 2001
From: Spoike <acceptthis@users.sourceforge.net>
Date: Wed, 3 Nov 2021 20:30:48 +0000
Subject: [PATCH] Try to fix up cef urls/win-compat.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6098 fc73d0e0-1445-4013-8a0c-d673dee63da5
---
 plugins/Makefile  | 16 ++++++++--------
 plugins/cef/cef.c | 19 ++++++++++++-------
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/plugins/Makefile b/plugins/Makefile
index 5e4507fc1..a92a7dc96 100644
--- a/plugins/Makefile
+++ b/plugins/Makefile
@@ -318,23 +318,23 @@ $(PLUG_PREFIX)bullet$(PLUG_NATIVE_EXT): bullet/bulletplug.cpp plugin.c $(BULLET_
 
 #WARNING: Changing CEF_VER requires updating downloadables.php etc
 ifeq ($(FTE_TARGET),win32)
-	CEF_ARCH=windows32
+    CEF_ARCH=windows32
 endif
 ifeq ($(FTE_TARGET),win64)
-	CEF_ARCH=windows64
+    CEF_ARCH=windows64
 endif
 ifeq ($(FTE_TARGET),linux32)
-	CEF_ARCH=linux32
+    CEF_ARCH=linux32
 endif
 ifeq ($(FTE_TARGET),linux64)
-	CEF_ARCH=linux64
+    CEF_ARCH=linux64
 endif
 #ifeq ($(FTE_TARGET),macosx64)
-	#CEF_ARCH=macosx64
+    #CEF_ARCH=macosx64
 #endif
-CEF_VER=3.3163.1666.g052c2d2
+CEF_VER=95.7.14+g9f72f35+chromium-95.0.4638.69
 CEF_NAME=cef_binary_$(CEF_VER)_$(CEF_ARCH)_minimal
-CEF_URL=http://opensource.spotify.com/cefbuilds/$(CEF_NAME).tar.bz2
+CEF_URL=https://cef-builds.spotifycdn.com/cef_binary_$(CEF_VER)_$(CEF_ARCH)_minimal.tar.bz2
 
 ifneq ($(CEF_ARCH),)
 cef/$(CEF_NAME)/include/cef_version.h:
@@ -354,7 +354,7 @@ $(PLUG_PREFIX)cef$(PLUG_NATIVE_EXT): $(CEF_SOURCES) $(OUT_DIR)/cef_$(CEF_VER).zi
 else
 .PHONEY: $(PLUG_PREFIX)cef$(PLUG_NATIVE_EXT)
 $(PLUG_PREFIX)cef$(PLUG_NATIVE_EXT):
-	echo cef plugin not supported on this arch - $(FTE_TARGET) - $(CEF_ARCH)
+	@echo cef plugin not supported on this arch - $(FTE_TARGET) - $(CEF_ARCH)
 endif
 ######################################
 
diff --git a/plugins/cef/cef.c b/plugins/cef/cef.c
index a8afaa612..680772379 100644
--- a/plugins/cef/cef.c
+++ b/plugins/cef/cef.c
@@ -21,8 +21,9 @@ static plugclientfuncs_t *clientfuncs;
 #endif
 #ifndef _WIN32
 #include <unistd.h>
-#include <sys/stat.h>
 #endif
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #define EXPECTED_COMMIT_NUMBER  2179	//last version of libcef we tried building against...
 #if EXPECTED_COMMIT_NUMBER != EXPECTED_COMMIT_NUMBER
@@ -1648,10 +1649,10 @@ static void *Cef_Create(const char *name, struct mediacallbacks_s *callbacks)
 #ifdef _WIN32
 		window_info.style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE;
 		window_info.parent_window = NULL;
-		window_info.x = CW_USEDEFAULT;
-		window_info.y = CW_USEDEFAULT;
-		window_info.width = CW_USEDEFAULT;
-		window_info.height = CW_USEDEFAULT;
+		window_info.bounds.x = CW_USEDEFAULT;
+		window_info.bounds.y = CW_USEDEFAULT;
+		window_info.bounds.width = CW_USEDEFAULT;
+		window_info.bounds.height = CW_USEDEFAULT;
 		window_info.window_name = makecefstring("CEF Dev Tools");
 #else
 		memset(&window_info.parent_window, 0, sizeof(window_info.parent_window));
@@ -1877,9 +1878,9 @@ static void VARGS Cef_ChangeStream (void *ctx, const char *streamname)
 	{
 		const char *cmd = streamname+4;
 		if (!strcmp(cmd, "focus"))
-			host->send_focus_event(host, true);
+			host->set_focus(host, true);
 		else if (!strcmp(cmd, "unfocus"))
-			host->send_focus_event(host, false);
+			host->set_focus(host, false);
 		else if (!strcmp(cmd, "refresh"))
 			browser->thebrowser->reload(browser->thebrowser);
 		else if (!strcmp(cmd, "transparent"))
@@ -2121,7 +2122,11 @@ static qboolean Cef_Init(qboolean engineprocess)
 			{NULL}
 		};
 
+#ifdef _WIN32
+		if (plugfuncs && !plugfuncs->LoadDLL("libcef", ceffuncs))
+#else
 		if (plugfuncs && !plugfuncs->LoadDLL("./libcef", ceffuncs))
+#endif
 		{
 			if (engineprocess)
 				Con_Printf("Unable to load libcef (version "CEF_VERSION")\n");