|
| 1 | +From 1fe2169be7444781746698b58607611c8ce516be Mon Sep 17 00:00:00 2001 |
| 2 | +From: Adrian Perez de Castro < [email protected]> |
| 3 | +Date: Mon, 17 Oct 2022 12:06:48 +0300 |
| 4 | +Subject: [PATCH] Hack Cog to make it buildable with WPE WebKit 2.22 |
| 5 | + |
| 6 | +--- |
| 7 | + CMakeLists.txt | 11 +++++------ |
| 8 | + cog.c | 9 +++++---- |
| 9 | + core/cog-webkit-utils.h | 4 ---- |
| 10 | + 3 files changed, 10 insertions(+), 14 deletions(-) |
| 11 | + |
| 12 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 13 | +index 2b7bf12..96d6861 100644 |
| 14 | +--- a/CMakeLists.txt |
| 15 | ++++ b/CMakeLists.txt |
| 16 | +@@ -122,9 +122,8 @@ if (COG_USE_WEBKITGTK) |
| 17 | + else () |
| 18 | + list(APPEND COGCORE_API_HEADERS core/cog-platform.h) |
| 19 | + list(APPEND COGCORE_SOURCES core/cog-platform.c) |
| 20 | +- # There is no need to explicitly check wpe-1.0 here because it's a |
| 21 | +- # dependency already specified in the wpe-webkit.pc file. |
| 22 | +- pkg_check_modules(WEB_ENGINE REQUIRED wpe-webkit-1.0>=2.23.91) |
| 23 | ++ pkg_check_modules(WEB_ENGINE REQUIRED wpe-webkit-0.1) |
| 24 | ++ pkg_check_modules(WPE REQUIRED IMPORTED_TARGET wpe-0.2) |
| 25 | + if ("${WEB_ENGINE_VERSION}" VERSION_GREATER "2.23") |
| 26 | + add_definitions(-DCOG_BG_COLOR_API_SUPPORTED=1) |
| 27 | + else () |
| 28 | +@@ -168,7 +167,7 @@ set_target_properties(cogcore PROPERTIES |
| 29 | + SOVERSION ${COGCORE_VERSION_MAJOR} |
| 30 | + ) |
| 31 | + target_include_directories(cogcore PUBLIC core ${COGCORE_INCLUDE_DIRS}) |
| 32 | +-target_link_libraries(cogcore ${COGCORE_LDFLAGS}) |
| 33 | ++target_link_libraries(cogcore PkgConfig::WPE ${COGCORE_LDFLAGS}) |
| 34 | + target_compile_options(cogcore |
| 35 | + PUBLIC ${COGCORE_CFLAGS} |
| 36 | + PRIVATE -DG_LOG_DOMAIN=\"Cog\" |
| 37 | +@@ -241,7 +240,7 @@ if (COG_PLATFORM_FDO AND NOT COG_USE_WEBKITGTK) |
| 38 | + endif () |
| 39 | + |
| 40 | + pkg_check_modules(COGPLATFORM_FDO_DEPS IMPORTED_TARGET REQUIRED |
| 41 | +- wpe-webkit-1.0>=2.24.0 wpebackend-fdo-1.0>=1.3.1 egl xkbcommon) |
| 42 | ++ wpe-webkit-0.1 wpebackend-fdo-1.0>=1.3.1 egl xkbcommon) |
| 43 | + |
| 44 | + target_link_libraries(cogplatform-fdo PRIVATE |
| 45 | + cogcore PkgConfig::WAYLAND PkgConfig::COGPLATFORM_FDO_DEPS) |
| 46 | +@@ -297,7 +296,7 @@ endif () # !COG_USE_WEBKITGTK |
| 47 | + # libcogplaform-drm |
| 48 | + |
| 49 | + if (COG_PLATFORM_DRM AND NOT COG_USE_WEBKITGTK) |
| 50 | +- pkg_check_modules(COGPLATFORM_DRM_DEPS REQUIRED wpe-webkit-1.0>=2.24.0 wpebackend-fdo-1.0>=1.3.1 libdrm>=2.4.71 gbm>=13.0 egl libinput libudev wayland-server) |
| 51 | ++ pkg_check_modules(COGPLATFORM_DRM_DEPS REQUIRED wpe-webkit-0.1 wpebackend-fdo-1.0>=1.3.1 libdrm>=2.4.71 gbm>=13.0 egl libinput libudev wayland-server) |
| 52 | + |
| 53 | + set(COGPLATFORM_DRM_INCLUDE_DIRS |
| 54 | + ${COGPLATFORM_DRM_DEPS_INCLUDE_DIRS} |
| 55 | +diff --git a/cog.c b/cog.c |
| 56 | +index 07def04..b536137 100644 |
| 57 | +--- a/cog.c |
| 58 | ++++ b/cog.c |
| 59 | +@@ -13,13 +13,14 @@ |
| 60 | + |
| 61 | + #if !COG_USE_WEBKITGTK |
| 62 | + # include "cog-platform.h" |
| 63 | +-#if defined(WPE_CHECK_VERSION) && WPE_CHECK_VERSION(1, 3, 0) |
| 64 | +-# define HAVE_DEVICE_SCALING 1 |
| 65 | +-#else |
| 66 | + # define HAVE_DEVICE_SCALING 0 |
| 67 | +-#endif /* WPE_CHECK_VERSION */ |
| 68 | + #endif /* !COG_USE_WEBKITGTK */ |
| 69 | + |
| 70 | ++#define webkit_get_major_version() 2 |
| 71 | ++#define webkit_get_minor_version() 22 |
| 72 | ++#define webkit_get_micro_version() 0 |
| 73 | ++ |
| 74 | ++ |
| 75 | + enum webprocess_fail_action { |
| 76 | + WEBPROCESS_FAIL_UNKNOWN = 0, |
| 77 | + WEBPROCESS_FAIL_ERROR_PAGE, |
| 78 | +diff --git a/core/cog-webkit-utils.h b/core/cog-webkit-utils.h |
| 79 | +index 08747de..1a0c23f 100644 |
| 80 | +--- a/core/cog-webkit-utils.h |
| 81 | ++++ b/core/cog-webkit-utils.h |
| 82 | +@@ -21,8 +21,6 @@ |
| 83 | + |
| 84 | + G_BEGIN_DECLS |
| 85 | + |
| 86 | +-#if !WEBKIT_CHECK_VERSION(2, 23, 0) |
| 87 | +- |
| 88 | + /* Define cleanup functions to enable using g_auto* with WebKit types. */ |
| 89 | + |
| 90 | + G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitWebContext, g_object_unref) |
| 91 | +@@ -31,8 +29,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitSettings, g_object_unref) |
| 92 | + G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitURISchemeRequest, g_object_unref) |
| 93 | + G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitWebsiteDataManager, g_object_unref) |
| 94 | + |
| 95 | +-#endif /* WEBKIT_CHECK_VERSION */ |
| 96 | +- |
| 97 | + #endif /* COG_USE_WEBKITGTK */ |
| 98 | + |
| 99 | + |
| 100 | +-- |
| 101 | +2.38.0 |
| 102 | + |
0 commit comments