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:
Kristian Høgsberg 2012-01-25 16:57:11 -05:00
parent 07f729441e
commit 6af8eb9c7f
6 changed files with 32 additions and 15 deletions

View file

@ -95,10 +95,10 @@ struct unlock_dialog {
struct desktop *desktop; struct desktop *desktop;
}; };
static char *key_background_image; static char *key_background_image = DATADIR "/weston/pattern.png";
static char *key_background_type; static char *key_background_type = "tile";
static uint32_t key_panel_color; static uint32_t key_panel_color = 0xaa000000;
static uint32_t key_background_color; static uint32_t key_background_color = 0xff002244;
static char *key_launcher_icon; static char *key_launcher_icon;
static char *key_launcher_path; static char *key_launcher_path;
static void launcher_section_done(void *data); static void launcher_section_done(void *data);
@ -690,11 +690,23 @@ launcher_section_done(void *data)
key_launcher_path = NULL; 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[]) int main(int argc, char *argv[])
{ {
struct desktop desktop = { 0 }; struct desktop desktop = { 0 };
char *config_file; char *config_file;
struct output *output; struct output *output;
int ret;
desktop.unlock_task.run = unlock_dialog_finish; desktop.unlock_task.run = unlock_dialog_finish;
wl_list_init(&desktop.outputs); wl_list_init(&desktop.outputs);
@ -721,10 +733,12 @@ int main(int argc, char *argv[])
} }
config_file = config_file_path("weston-desktop-shell.ini"); config_file = config_file_path("weston-desktop-shell.ini");
parse_config_file(config_file, ret = parse_config_file(config_file,
config_sections, ARRAY_LENGTH(config_sections), config_sections, ARRAY_LENGTH(config_sections),
&desktop); &desktop);
free(config_file); free(config_file);
if (ret < 0)
add_default_launcher(&desktop);
signal(SIGCHLD, sigchild_handler); signal(SIGCHLD, sigchild_handler);

View file

@ -1,6 +1,11 @@
For the DMZ cursors:
(c) 2007-2010 Novell, Inc. (c) 2007-2010 Novell, Inc.
This work is licenced under the Creative Commons Attribution-Share Alike 3.0 This work is licenced under the Creative Commons Attribution-Share Alike 3.0
United States License. To view a copy of this licence, visit 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 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. 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.

View file

@ -20,7 +20,9 @@ dist_westondata_DATA = \
top_side.png \ top_side.png \
xterm.png \ xterm.png \
wayland.svg \ wayland.svg \
$(wayland_icon_png) $(wayland_icon_png) \
pattern.png \
terminal.png
if HAVE_RSVG_CONVERT if HAVE_RSVG_CONVERT
wayland_icon_png = wayland.png wayland_icon_png = wayland.png

BIN
data/pattern.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
data/terminal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,005 B

View file

@ -110,10 +110,9 @@ struct weston_move_grab {
int32_t dx, dy; int32_t dx, dy;
}; };
static int static void
shell_configuration(struct wl_shell *shell) shell_configuration(struct wl_shell *shell)
{ {
int ret;
char *config_file; char *config_file;
char *path = NULL; char *path = NULL;
int duration = 60; int duration = 60;
@ -128,13 +127,11 @@ shell_configuration(struct wl_shell *shell)
}; };
config_file = config_file_path("weston-desktop-shell.ini"); 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); free(config_file);
shell->screensaver.path = path; shell->screensaver.path = path;
shell->screensaver.duration = duration; shell->screensaver.duration = duration;
return ret;
} }
static void static void
@ -1447,8 +1444,7 @@ shell_init(struct weston_compositor *ec)
wl_list_init(&shell->panels); wl_list_init(&shell->panels);
wl_list_init(&shell->screensaver.surfaces); wl_list_init(&shell->screensaver.surfaces);
if (shell_configuration(shell) < 0) shell_configuration(shell);
return -1;
if (wl_display_add_global(ec->wl_display, &wl_shell_interface, if (wl_display_add_global(ec->wl_display, &wl_shell_interface,
shell, bind_shell) == NULL) shell, bind_shell) == NULL)