cog: add small usability improvements

Add two patches to improve user experience, such as making the browser
fullscreen and removing the otherwise necessary --platform parameter.

Also, make www.digi.com the default URI to avoid having to explicitly pass a
URI when launching cog.

https://jira.digi.com/browse/DEL-7311
https://jira.digi.com/browse/DEL-7339

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2020-12-09 16:53:02 +01:00
parent 590b824967
commit cfa11005ee
3 changed files with 137 additions and 0 deletions

View File

@ -0,0 +1,66 @@
From: Gabriel Valcazar <gabriel.valcazar@digi.com>
Date: Tue, 10 Nov 2020 16:32:15 +0100
Subject: [PATCH 3/4] 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 | 27 ++++-----------------------
1 file changed, 4 insertions(+), 23 deletions(-)
diff --git a/cog.c b/cog.c
index 950b14d..5f47d87 100644
--- a/cog.c
+++ b/cog.c
@@ -43,10 +43,7 @@ static struct {
GStrv arguments;
char *background_color;
#if !COG_USE_WEBKITGTK
- union {
- char *platform_name;
- CogPlatform *platform;
- };
+ CogPlatform *platform;
#endif // !COG_USE_WEBKITGTK
union {
char *action_name;
@@ -95,11 +92,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" },
-#if !COG_USE_WEBKITGTK
- { "platform", 'P', 0, G_OPTION_ARG_STRING, &s_options.platform_name,
- "Platform plug-in to use.",
- "NAME" },
-#endif // !COG_USE_WEBKITGTK
{ "web-extensions-dir", '\0', 0, G_OPTION_ARG_STRING, &s_options.web_extensions_dir,
"Load Web Extensions from given directory.",
"PATH"},
@@ -301,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;
}

View File

@ -0,0 +1,67 @@
From: Gabriel Valcazar <gabriel.valcazar@digi.com>
Date: Tue, 10 Nov 2020 16:36:21 +0100
Subject: [PATCH 4/4] 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/cog-platform-fdo.c | 44 ++++++++++---------------------------
1 file changed, 12 insertions(+), 32 deletions(-)
diff --git a/platform/cog-platform-fdo.c b/platform/cog-platform-fdo.c
index 7bdf075..08b0b21 100644
--- a/platform/cog-platform-fdo.c
+++ b/platform/cog-platform-fdo.c
@@ -1911,39 +1911,19 @@ 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.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.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;

View File

@ -5,4 +5,8 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI_append = " \
file://0001-platform-add-a-common-EGL-proc-address-loader-with-d.patch \
file://0002-egl-proc-address.h-add-a-license-header.patch \
file://0003-cog-remove-the-platform-parameter-and-hardcode-the-F.patch \
file://0004-cog-platform-fdo-always-use-fullscreen-mode.patch \
"
EXTRA_OECMAKE += "-DCOG_HOME_URI=www.digi.com"