cog: adapt patches to v0.12.0
Now that the "--platform" parameter is optional, we don't need to hardcode the platform anymore, so remove the first patch. In this version, the FDO platform has been renamed to WL, and since the default PACKAGECONFIG is meant to work with older cog versions, we need to manually append the "wl" PACKAGECONFIG to build the wayland platform. Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
parent
3a62855de4
commit
668b4e8138
|
|
@ -0,0 +1,61 @@
|
||||||
|
From: Gabriel Valcazar <gabriel.valcazar@digi.com>
|
||||||
|
Date: Wed, 23 Jun 2021 10:17:59 +0200
|
||||||
|
Subject: [PATCH] cog-platform-fdo: always use fullscreen mode
|
||||||
|
|
||||||
|
Otherwise, the browser will spawn on a random place on the desktop every time.
|
||||||
|
|
||||||
|
Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
|
||||||
|
---
|
||||||
|
platform/wayland/cog-platform-wl.c | 37 +++++++++---------------------
|
||||||
|
1 file changed, 11 insertions(+), 26 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/platform/wayland/cog-platform-wl.c b/platform/wayland/cog-platform-wl.c
|
||||||
|
index f62faad..fe6b866 100644
|
||||||
|
--- a/platform/wayland/cog-platform-wl.c
|
||||||
|
+++ b/platform/wayland/cog-platform-wl.c
|
||||||
|
@@ -2184,34 +2184,19 @@ create_window (GError **error)
|
||||||
|
configure_surface_geometry(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
- const char *env_var;
|
||||||
|
- if ((env_var = g_getenv("COG_PLATFORM_WL_VIEW_FULLSCREEN")) && g_ascii_strtoll(env_var, NULL, 10) > 0) {
|
||||||
|
- win_data.is_maximized = false;
|
||||||
|
- win_data.is_fullscreen = true;
|
||||||
|
+ win_data.is_maximized = false;
|
||||||
|
+ win_data.is_fullscreen = true;
|
||||||
|
|
||||||
|
- if (wl_data.xdg_shell != NULL) {
|
||||||
|
- xdg_toplevel_set_fullscreen(win_data.xdg_toplevel, NULL);
|
||||||
|
- } else if (wl_data.fshell != NULL) {
|
||||||
|
- win_data.should_resize_to_largest_output = true;
|
||||||
|
- resize_to_largest_output();
|
||||||
|
- } else if (wl_data.shell != NULL) {
|
||||||
|
- wl_shell_surface_set_fullscreen(win_data.shell_surface, WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE, 0, NULL);
|
||||||
|
- } else {
|
||||||
|
- g_warning("No available shell capable of fullscreening.");
|
||||||
|
- win_data.is_fullscreen = false;
|
||||||
|
- }
|
||||||
|
- } else if ((env_var = g_getenv("COG_PLATFORM_WL_VIEW_MAXIMIZE")) && g_ascii_strtoll(env_var, NULL, 10) > 0) {
|
||||||
|
- win_data.is_maximized = true;
|
||||||
|
+ if (wl_data.xdg_shell != NULL) {
|
||||||
|
+ xdg_toplevel_set_fullscreen(win_data.xdg_toplevel, NULL);
|
||||||
|
+ } else if (wl_data.fshell != NULL) {
|
||||||
|
+ win_data.should_resize_to_largest_output = true;
|
||||||
|
+ resize_to_largest_output();
|
||||||
|
+ } else if (wl_data.shell != NULL) {
|
||||||
|
+ wl_shell_surface_set_fullscreen(win_data.shell_surface, WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE, 0, NULL);
|
||||||
|
+ } else {
|
||||||
|
+ g_warning("No available shell capable of fullscreening.");
|
||||||
|
win_data.is_fullscreen = false;
|
||||||
|
-
|
||||||
|
- if (wl_data.xdg_shell != NULL) {
|
||||||
|
- xdg_toplevel_set_maximized (win_data.xdg_toplevel);
|
||||||
|
- } else if (wl_data.shell != NULL) {
|
||||||
|
- wl_shell_surface_set_maximized (win_data.shell_surface, NULL);
|
||||||
|
- } else {
|
||||||
|
- g_warning ("No available shell capable of maximizing.");
|
||||||
|
- win_data.is_maximized = false;
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
From: Gabriel Valcazar <gabriel.valcazar@digi.com>
|
|
||||||
Date: Wed, 23 Jun 2021 10:05:24 +0200
|
|
||||||
Subject: [PATCH 1/2] cog: remove the --platform parameter and hardcode the FDO
|
|
||||||
platform
|
|
||||||
|
|
||||||
We don't want users to accidentally generate errors by using different
|
|
||||||
platforms, so always use the FDO one by default.
|
|
||||||
|
|
||||||
Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
|
|
||||||
---
|
|
||||||
cog.c | 25 ++++---------------------
|
|
||||||
1 file changed, 4 insertions(+), 21 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/cog.c b/cog.c
|
|
||||||
index 2fdc7b2..bb64506 100644
|
|
||||||
--- a/cog.c
|
|
||||||
+++ b/cog.c
|
|
||||||
@@ -40,10 +40,7 @@ static struct {
|
|
||||||
GStrv dir_handlers;
|
|
||||||
GStrv arguments;
|
|
||||||
char *background_color;
|
|
||||||
- union {
|
|
||||||
- char *platform_name;
|
|
||||||
- CogPlatform *platform;
|
|
||||||
- };
|
|
||||||
+ CogPlatform *platform;
|
|
||||||
union {
|
|
||||||
char *action_name;
|
|
||||||
enum webprocess_fail_action action_id;
|
|
||||||
@@ -92,9 +89,6 @@ static GOptionEntry s_cli_options[] =
|
|
||||||
{ "bg-color", 'b', 0, G_OPTION_ARG_STRING, &s_options.background_color,
|
|
||||||
"Background color, as a CSS name or in #RRGGBBAA hex syntax (default: white)",
|
|
||||||
"BG_COLOR" },
|
|
||||||
- { "platform", 'P', 0, G_OPTION_ARG_STRING, &s_options.platform_name,
|
|
||||||
- "Platform plug-in to use.",
|
|
||||||
- "NAME" },
|
|
||||||
{ "web-extensions-dir", '\0', 0, G_OPTION_ARG_STRING, &s_options.web_extensions_dir,
|
|
||||||
"Load Web Extensions from given directory.",
|
|
||||||
"PATH"},
|
|
||||||
@@ -299,21 +293,10 @@ platform_setup (CogShell *shell)
|
|
||||||
* a given platform.
|
|
||||||
*/
|
|
||||||
|
|
||||||
- g_debug ("%s: Platform name: %s", __func__, s_options.platform_name);
|
|
||||||
-
|
|
||||||
- if (!s_options.platform_name)
|
|
||||||
- return FALSE;
|
|
||||||
-
|
|
||||||
- g_autofree char *platform_soname =
|
|
||||||
- g_strdup_printf ("libcogplatform-%s.so", s_options.platform_name);
|
|
||||||
- g_clear_pointer (&s_options.platform_name, g_free);
|
|
||||||
-
|
|
||||||
- g_debug ("%s: Platform plugin: %s", __func__, platform_soname);
|
|
||||||
-
|
|
||||||
g_autoptr(CogPlatform) platform = cog_platform_new ();
|
|
||||||
- if (!cog_platform_try_load (platform, platform_soname)) {
|
|
||||||
- g_warning ("Could not load: %s (possible cause: %s).\n",
|
|
||||||
- platform_soname, strerror (errno));
|
|
||||||
+ if (!cog_platform_try_load (platform, "libcogplatform-fdo.so")) {
|
|
||||||
+ g_warning ("Could not load: libcogplatform-fdo.so (possible cause: %s).\n",
|
|
||||||
+ strerror (errno));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
From: Gabriel Valcazar <gabriel.valcazar@digi.com>
|
|
||||||
Date: Wed, 23 Jun 2021 10:17:59 +0200
|
|
||||||
Subject: [PATCH 2/2] cog-platform-fdo: always use fullscreen mode
|
|
||||||
|
|
||||||
Otherwise, the browser will spawn on a random place on the desktop every time.
|
|
||||||
|
|
||||||
Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
|
|
||||||
---
|
|
||||||
platform/fdo/cog-platform-fdo.c | 50 ++++++++++-----------------------
|
|
||||||
1 file changed, 15 insertions(+), 35 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/platform/fdo/cog-platform-fdo.c b/platform/fdo/cog-platform-fdo.c
|
|
||||||
index c7e1eea..4f6c0c7 100644
|
|
||||||
--- a/platform/fdo/cog-platform-fdo.c
|
|
||||||
+++ b/platform/fdo/cog-platform-fdo.c
|
|
||||||
@@ -2134,42 +2134,22 @@ create_window (GError **error)
|
|
||||||
configure_surface_geometry (0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
- const char* env_var;
|
|
||||||
- if ((env_var = g_getenv ("COG_PLATFORM_FDO_VIEW_FULLSCREEN")) &&
|
|
||||||
- g_ascii_strtoll (env_var, NULL, 10) > 0)
|
|
||||||
- {
|
|
||||||
- win_data.is_maximized = false;
|
|
||||||
- win_data.is_fullscreen = true;
|
|
||||||
-
|
|
||||||
- if (wl_data.xdg_shell != NULL) {
|
|
||||||
- xdg_toplevel_set_fullscreen (win_data.xdg_toplevel, NULL);
|
|
||||||
- } else if (wl_data.fshell != NULL) {
|
|
||||||
- win_data.should_resize_to_largest_output = true;
|
|
||||||
- resize_to_largest_output ();
|
|
||||||
- } else if (wl_data.shell != NULL) {
|
|
||||||
- wl_shell_surface_set_fullscreen (win_data.shell_surface,
|
|
||||||
- WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE,
|
|
||||||
- 0,
|
|
||||||
- NULL);
|
|
||||||
- } else {
|
|
||||||
- g_warning ("No available shell capable of fullscreening.");
|
|
||||||
- win_data.is_fullscreen = false;
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
- else if ((env_var = g_getenv ("COG_PLATFORM_FDO_VIEW_MAXIMIZE")) &&
|
|
||||||
- g_ascii_strtoll (env_var, NULL, 10) > 0)
|
|
||||||
- {
|
|
||||||
- win_data.is_maximized = true;
|
|
||||||
- win_data.is_fullscreen = false;
|
|
||||||
+ win_data.is_maximized = false;
|
|
||||||
+ win_data.is_fullscreen = true;
|
|
||||||
|
|
||||||
- if (wl_data.xdg_shell != NULL) {
|
|
||||||
- xdg_toplevel_set_maximized (win_data.xdg_toplevel);
|
|
||||||
- } else if (wl_data.shell != NULL) {
|
|
||||||
- wl_shell_surface_set_maximized (win_data.shell_surface, NULL);
|
|
||||||
- } else {
|
|
||||||
- g_warning ("No available shell capable of maximizing.");
|
|
||||||
- win_data.is_maximized = false;
|
|
||||||
- }
|
|
||||||
+ if (wl_data.xdg_shell != NULL) {
|
|
||||||
+ xdg_toplevel_set_fullscreen (win_data.xdg_toplevel, NULL);
|
|
||||||
+ } else if (wl_data.fshell != NULL) {
|
|
||||||
+ win_data.should_resize_to_largest_output = true;
|
|
||||||
+ resize_to_largest_output ();
|
|
||||||
+ } else if (wl_data.shell != NULL) {
|
|
||||||
+ wl_shell_surface_set_fullscreen (win_data.shell_surface,
|
|
||||||
+ WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE,
|
|
||||||
+ 0,
|
|
||||||
+ NULL);
|
|
||||||
+ } else {
|
|
||||||
+ g_warning ("No available shell capable of fullscreening.");
|
|
||||||
+ win_data.is_fullscreen = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
|
|
@ -1,14 +1,17 @@
|
||||||
# Copyright 2020-2021 Digi International Inc.
|
# Copyright 2020-2022 Digi International Inc.
|
||||||
|
|
||||||
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
|
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
|
||||||
|
|
||||||
SRC_URI_append = " \
|
SRC_URI_append = " \
|
||||||
file://0001-cog-remove-the-platform-parameter-and-hardcode-the-F.patch \
|
file://0001-cog-platform-fdo-always-use-fullscreen-mode.patch \
|
||||||
file://0002-cog-platform-fdo-always-use-fullscreen-mode.patch \
|
|
||||||
"
|
"
|
||||||
|
|
||||||
EXTRA_OECMAKE += "-DCOG_HOME_URI=http://127.0.0.1/"
|
EXTRA_OECMAKE += "-DCOG_HOME_URI=http://127.0.0.1/"
|
||||||
|
|
||||||
|
# Starting in v0.12.X, we need to explicitly enable the wl PACKAGECONFIG to
|
||||||
|
# include the wayland platform
|
||||||
|
PACKAGECONFIG += "wl"
|
||||||
|
|
||||||
# drm PACKAGECONFIG pulls in libgbm dependency, which isn't available
|
# drm PACKAGECONFIG pulls in libgbm dependency, which isn't available
|
||||||
# on the i.MX6
|
# on the i.MX6
|
||||||
PACKAGECONFIG_remove_ccimx6 = "drm"
|
PACKAGECONFIG_remove_ccimx6 = "drm"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue