Make Weston desktop-shell panel configurable (backport)
[AGL/meta-agl.git] / meta-agl / recipes-graphics / wayland / weston / 0001-desktop-shell-add-option-to-avoid-creating-the-panel.patch
1 From e67118c80ad411ac46b7096aae2635510c80ea6d Mon Sep 17 00:00:00 2001
2 From: Jonny Lamb <jonny.lamb@collabora.co.uk>
3 Date: Tue, 12 Aug 2014 15:07:51 +0200
4 Subject: desktop-shell: add option to avoid creating the panel
5
6 This option is so we can disable showing any panel at all. The default
7 is to continue showing the panel and no example is added to weston.ini
8 because it's an uncommon request.
9
10 Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
11 ---
12
13 --- a/clients/desktop-shell.c   2015-11-05 11:51:26.272052133 +0000
14 +++ b/clients/desktop-shell.c   2015-11-05 11:56:19.666887702 +0000
15 @@ -1130,7 +1130,8 @@
16  output_destroy(struct output *output)
17  {
18         background_destroy(output->background);
19 -       panel_destroy(output->panel);
20 +       if (output->panel)
21 +               panel_destroy(output->panel);
22         wl_output_destroy(output->output);
23         wl_list_remove(&output->link);
24  
25 @@ -1160,7 +1161,8 @@
26  {
27         struct output *output = data;
28  
29 -       window_set_buffer_transform(output->panel->window, transform);
30 +       if (output->panel)
31 +               window_set_buffer_transform(output->panel->window, transform);
32         window_set_buffer_transform(output->background->window, transform);
33  }
34  
35 @@ -1187,7 +1189,8 @@
36  {
37         struct output *output = data;
38  
39 -       window_set_buffer_scale(output->panel->window, scale);
40 +       if (output->panel)
41 +               window_set_buffer_scale(output->panel->window, scale);
42         window_set_buffer_scale(output->background->window, scale);
43  }
44  
45 @@ -1198,15 +1201,36 @@
46         output_handle_scale
47  };
48  
49 +static int
50 +want_panel(struct desktop *desktop)
51 +{
52 +       struct weston_config_section *s;
53 +       char *location = NULL;
54 +       int ret = 1;
55 +
56 +       s = weston_config_get_section(desktop->config, "shell", NULL, NULL);
57 +       weston_config_section_get_string(s, "panel-location",
58 +                                        &location, "top");
59 +
60 +       if (strcmp(location, "top") != 0)
61 +               ret = 0;
62 +
63 +       free(location);
64 +
65 +       return ret;
66 +}
67 +
68  static void
69  output_init(struct output *output, struct desktop *desktop)
70  {
71         struct wl_surface *surface;
72  
73 -       output->panel = panel_create(desktop);
74 -       surface = window_get_wl_surface(output->panel->window);
75 -       desktop_shell_set_panel(desktop->shell,
76 -                               output->output, surface);
77 +       if (want_panel(desktop)) {
78 +               output->panel = panel_create(desktop);
79 +               surface = window_get_wl_surface(output->panel->window);
80 +               desktop_shell_set_panel(desktop->shell,
81 +                                       output->output, surface);
82 +       }
83  
84         output->background = background_create(desktop);
85         surface = window_get_wl_surface(output->background->window);
86 --- a/man/weston.ini.man        2015-11-05 11:56:36.763111313 +0000
87 +++ b/man/weston.ini.man        2015-11-05 12:06:57.097226512 +0000
88 @@ -186,6 +186,11 @@
89  .fi
90  .RE
91  .TP 7
92 +.BI "panel-location=" top
93 +sets the location of the panel (string). Can be
94 +.B top,
95 +.B none.
96 +.TP 7
97  .BI "locking=" true
98  enables screen locking (boolean).
99  .TP 7