X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=clients%2Fdesktop-shell.c;h=db4a1fd756fb9ccc175397268edafc09b1da811b;hb=e67118c80ad411ac46b7096aae2635510c80ea6d;hp=a0c6b6d4dce9c6bd9405dd6fa85b1187f72c5d67;hpb=3c946779df0063ffc5ce7e649b8670a24824c99c;p=platform%2Fupstream%2Fweston.git diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index a0c6b6d..db4a1fd 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -146,7 +146,7 @@ sigchild_handler(int s) } static void -menu_func(struct window *window, struct input *input, int index, void *data) +menu_func(void *data, struct input *input, int index) { printf("Selected index %d from a panel menu.\n", index); } @@ -709,6 +709,8 @@ background_draw(struct widget *widget, void *data) image = NULL; if (background->image) image = load_cairo_surface(background->image); + else if (background->color == 0) + image = load_cairo_surface(DATADIR "/weston/pattern.png"); if (image && background->type != -1) { im_w = cairo_image_surface_get_width(image); @@ -722,6 +724,7 @@ background_draw(struct widget *widget, void *data) case BACKGROUND_SCALE: cairo_matrix_init_scale(&matrix, sx, sy); cairo_pattern_set_matrix(pattern, &matrix); + cairo_pattern_set_extend(pattern, CAIRO_EXTEND_PAD); break; case BACKGROUND_SCALE_CROP: s = (sx < sy) ? sx : sy; @@ -731,6 +734,7 @@ background_draw(struct widget *widget, void *data) cairo_matrix_init_translate(&matrix, tx, ty); cairo_matrix_scale(&matrix, s, s); cairo_pattern_set_matrix(pattern, &matrix); + cairo_pattern_set_extend(pattern, CAIRO_EXTEND_PAD); break; case BACKGROUND_TILE: cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT); @@ -1057,10 +1061,9 @@ background_create(struct desktop *desktop) s = weston_config_get_section(desktop->config, "shell", NULL, NULL); weston_config_section_get_string(s, "background-image", - &background->image, - DATADIR "/weston/pattern.png"); + &background->image, NULL); weston_config_section_get_uint(s, "background-color", - &background->color, 0xff002244); + &background->color, 0); weston_config_section_get_string(s, "background-type", &type, "tile"); @@ -1127,7 +1130,8 @@ static void output_destroy(struct output *output) { background_destroy(output->background); - panel_destroy(output->panel); + if (output->panel) + panel_destroy(output->panel); wl_output_destroy(output->output); wl_list_remove(&output->link); @@ -1157,7 +1161,8 @@ output_handle_geometry(void *data, { struct output *output = data; - window_set_buffer_transform(output->panel->window, transform); + if (output->panel) + window_set_buffer_transform(output->panel->window, transform); window_set_buffer_transform(output->background->window, transform); } @@ -1184,7 +1189,8 @@ output_handle_scale(void *data, { struct output *output = data; - window_set_buffer_scale(output->panel->window, scale); + if (output->panel) + window_set_buffer_scale(output->panel->window, scale); window_set_buffer_scale(output->background->window, scale); } @@ -1195,15 +1201,36 @@ static const struct wl_output_listener output_listener = { output_handle_scale }; +static int +want_panel(struct desktop *desktop) +{ + struct weston_config_section *s; + char *location = NULL; + int ret = 1; + + s = weston_config_get_section(desktop->config, "shell", NULL, NULL); + weston_config_section_get_string(s, "panel-location", + &location, "top"); + + if (strcmp(location, "top") != 0) + ret = 0; + + free(location); + + return ret; +} + static void output_init(struct output *output, struct desktop *desktop) { struct wl_surface *surface; - output->panel = panel_create(desktop); - surface = window_get_wl_surface(output->panel->window); - desktop_shell_set_panel(desktop->shell, - output->output, surface); + if (want_panel(desktop)) { + output->panel = panel_create(desktop); + surface = window_get_wl_surface(output->panel->window); + desktop_shell_set_panel(desktop->shell, + output->output, surface); + } output->background = background_create(desktop); surface = window_get_wl_surface(output->background->window);