summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2021-03-26 15:55:05 +0200
committerMarius Vlad <marius.vlad@collabora.com>2021-04-04 19:00:31 +0300
commit73aaf14ebe9157baf825a02525c850606b66d202 (patch)
treebd3bd1b00a07bf442bd48855d4bf725b85e8a7fe
parentbf3e2001696cde5969d3acf90eb564dc180b2140 (diff)
downloadweston-73aaf14ebe9157baf825a02525c850606b66d202.tar.gz
kiosk-shell: Read background-color from ini file
desktop-shell's client is able to read-up from the config file, [shell] section the background, but for kiosk-shell we don't actually have client that does that, so instead allow the shell do that directly. Seems to be a useful thing to have, as a default background color. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-rw-r--r--kiosk-shell/kiosk-shell.c19
-rw-r--r--kiosk-shell/kiosk-shell.h2
2 files changed, 20 insertions, 1 deletions
diff --git a/kiosk-shell/kiosk-shell.c b/kiosk-shell/kiosk-shell.c
index d08167e2..8f0f49ec 100644
--- a/kiosk-shell/kiosk-shell.c
+++ b/kiosk-shell/kiosk-shell.c
@@ -458,6 +458,9 @@ kiosk_shell_output_recreate_background(struct kiosk_shell_output *shoutput)
{
struct kiosk_shell *shell = shoutput->shell;
struct weston_output *output = shoutput->output;
+ struct weston_config_section *shell_section = NULL;
+ uint32_t bg_color = 0x0;
+ float r, g, b;
if (shoutput->background_view)
weston_surface_destroy(shoutput->background_view->surface);
@@ -465,9 +468,19 @@ kiosk_shell_output_recreate_background(struct kiosk_shell_output *shoutput)
if (!output)
return;
+ if (shell->config)
+ shell_section = weston_config_get_section(shell->config, "shell", NULL, NULL);
+ if (shell_section)
+ weston_config_section_get_color(shell_section, "background-color",
+ &bg_color, 0x00000000);
+
+ r = ((bg_color >> 16) & 0xff) / 255.0;
+ b = ((bg_color >> 8) & 0xff) / 255.0,
+ g = ((bg_color >> 0) & 0xff) / 255.0;
+
shoutput->background_view =
create_colored_surface(shoutput->shell->compositor,
- 0.5, 0.5, 0.5,
+ r, g, b,
output->x, output->y,
output->width,
output->height);
@@ -1068,6 +1081,7 @@ wet_shell_init(struct weston_compositor *ec,
struct kiosk_shell *shell;
struct weston_seat *seat;
struct weston_output *output;
+ const char *config_file;
shell = zalloc(sizeof *shell);
if (shell == NULL)
@@ -1085,6 +1099,9 @@ wet_shell_init(struct weston_compositor *ec,
shell->transform_listener.notify = transform_handler;
wl_signal_add(&ec->transform_signal, &shell->transform_listener);
+ config_file = weston_config_get_name_from_env();
+ shell->config = weston_config_parse(config_file);
+
weston_layer_init(&shell->background_layer, ec);
weston_layer_init(&shell->normal_layer, ec);
diff --git a/kiosk-shell/kiosk-shell.h b/kiosk-shell/kiosk-shell.h
index 79c85f4f..a88c5317 100644
--- a/kiosk-shell/kiosk-shell.h
+++ b/kiosk-shell/kiosk-shell.h
@@ -26,6 +26,7 @@
#include <libweston-desktop/libweston-desktop.h>
#include <libweston/libweston.h>
+#include <libweston/config-parser.h>
struct kiosk_shell {
struct weston_compositor *compositor;
@@ -45,6 +46,7 @@ struct kiosk_shell {
struct wl_list seat_list;
const struct weston_xwayland_surface_api *xwayland_surface_api;
+ struct weston_config *config;
};
struct kiosk_shell_surface {