mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 04:40:07 +01:00
desktop-shell: Build in sensible defaults
This adds a default background pattern and a terminal launcher in case we don't have a config file.
This commit is contained in:
parent
07f729441e
commit
6af8eb9c7f
6 changed files with 32 additions and 15 deletions
|
|
@ -95,10 +95,10 @@ struct unlock_dialog {
|
|||
struct desktop *desktop;
|
||||
};
|
||||
|
||||
static char *key_background_image;
|
||||
static char *key_background_type;
|
||||
static uint32_t key_panel_color;
|
||||
static uint32_t key_background_color;
|
||||
static char *key_background_image = DATADIR "/weston/pattern.png";
|
||||
static char *key_background_type = "tile";
|
||||
static uint32_t key_panel_color = 0xaa000000;
|
||||
static uint32_t key_background_color = 0xff002244;
|
||||
static char *key_launcher_icon;
|
||||
static char *key_launcher_path;
|
||||
static void launcher_section_done(void *data);
|
||||
|
|
@ -690,11 +690,23 @@ launcher_section_done(void *data)
|
|||
key_launcher_path = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
add_default_launcher(struct desktop *desktop)
|
||||
{
|
||||
struct output *output;
|
||||
|
||||
wl_list_for_each(output, &desktop->outputs, link)
|
||||
panel_add_launcher(output->panel,
|
||||
DATADIR "/weston/terminal.png",
|
||||
"/usr/bin/weston-terminal");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct desktop desktop = { 0 };
|
||||
char *config_file;
|
||||
struct output *output;
|
||||
int ret;
|
||||
|
||||
desktop.unlock_task.run = unlock_dialog_finish;
|
||||
wl_list_init(&desktop.outputs);
|
||||
|
|
@ -721,10 +733,12 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
config_file = config_file_path("weston-desktop-shell.ini");
|
||||
parse_config_file(config_file,
|
||||
config_sections, ARRAY_LENGTH(config_sections),
|
||||
&desktop);
|
||||
ret = parse_config_file(config_file,
|
||||
config_sections, ARRAY_LENGTH(config_sections),
|
||||
&desktop);
|
||||
free(config_file);
|
||||
if (ret < 0)
|
||||
add_default_launcher(&desktop);
|
||||
|
||||
signal(SIGCHLD, sigchild_handler);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
For the DMZ cursors:
|
||||
|
||||
(c) 2007-2010 Novell, Inc.
|
||||
|
||||
This work is licenced under the Creative Commons Attribution-Share Alike 3.0
|
||||
United States License. To view a copy of this licence, visit
|
||||
http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
|
||||
Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA.
|
||||
|
||||
The terminal icon is taken from the gnome-icon-theme collection which
|
||||
is also distributed under the Creative Commons BY-SA 3.0 license.
|
||||
|
|
@ -20,7 +20,9 @@ dist_westondata_DATA = \
|
|||
top_side.png \
|
||||
xterm.png \
|
||||
wayland.svg \
|
||||
$(wayland_icon_png)
|
||||
$(wayland_icon_png) \
|
||||
pattern.png \
|
||||
terminal.png
|
||||
|
||||
if HAVE_RSVG_CONVERT
|
||||
wayland_icon_png = wayland.png
|
||||
|
|
|
|||
BIN
data/pattern.png
Normal file
BIN
data/pattern.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
data/terminal.png
Normal file
BIN
data/terminal.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1,005 B |
10
src/shell.c
10
src/shell.c
|
|
@ -110,10 +110,9 @@ struct weston_move_grab {
|
|||
int32_t dx, dy;
|
||||
};
|
||||
|
||||
static int
|
||||
static void
|
||||
shell_configuration(struct wl_shell *shell)
|
||||
{
|
||||
int ret;
|
||||
char *config_file;
|
||||
char *path = NULL;
|
||||
int duration = 60;
|
||||
|
|
@ -128,13 +127,11 @@ shell_configuration(struct wl_shell *shell)
|
|||
};
|
||||
|
||||
config_file = config_file_path("weston-desktop-shell.ini");
|
||||
ret = parse_config_file(config_file, cs, ARRAY_LENGTH(cs), shell);
|
||||
parse_config_file(config_file, cs, ARRAY_LENGTH(cs), shell);
|
||||
free(config_file);
|
||||
|
||||
shell->screensaver.path = path;
|
||||
shell->screensaver.duration = duration;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1447,8 +1444,7 @@ shell_init(struct weston_compositor *ec)
|
|||
wl_list_init(&shell->panels);
|
||||
wl_list_init(&shell->screensaver.surfaces);
|
||||
|
||||
if (shell_configuration(shell) < 0)
|
||||
return -1;
|
||||
shell_configuration(shell);
|
||||
|
||||
if (wl_display_add_global(ec->wl_display, &wl_shell_interface,
|
||||
shell, bind_shell) == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue