Skip to content
Commits on Source (18)
  • Daniel Stone's avatar
    compositor: Fix harmless potential buffer overflow · f48cf18a
    Daniel Stone authored
    
    
    We could overflow a local buffer if there were more than ten million
    concurrently active displays within the current user's session. This
    seems vanishingly unlikely, and harmless, but does at least squash a
    compiler warning emitted by gcc 12+.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    f48cf18a
  • Daniel Stone's avatar
    pixel-formats: Add XYUV8888 format · c8a2fb7a
    Daniel Stone authored
    
    
    XYUV8888 support was added to gl-renderer in 30104bd8, but not to
    pixel-formats. Oops.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    c8a2fb7a
  • Daniel Stone's avatar
    desktop-shell: Explicitly destroy black views on shutdown · 7059ec78
    Daniel Stone authored
    
    
    desktop_shell_removed() won't get called when we shut down, so
    explicitly destroy the fullscreen black view.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    7059ec78
  • Daniel Stone's avatar
    shell: Rename solid_color_surface to weston_curtain · b77c2374
    Daniel Stone authored
    
    
    create_solid_color_surface actually returns a weston_view that it
    creates internally. Since weston_solid_color_view is long and dull,
    rename it to weston_curtain.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    b77c2374
  • Daniel Stone's avatar
    shell: Rename weston_solid_color_surface to weston_curtain_params · 3a298b0b
    Daniel Stone authored
    
    
    The name implied that it was a surface in and of itself, rather than
    parameters used by a helper to create a surface and view.
    
    Rename it now that we have weston_curtain as a name, and clean up
    initialisers.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    3a298b0b
  • Daniel Stone's avatar
    shell: Move weston_curtain_create params into the struct · d2156336
    Daniel Stone authored
    
    
    Given that we have a struct for argument params, we might as well use it
    rather than have them split between the struct and native params. For
    consistency between the implementations, this also includes a shift from
    float to int positioning for the base offset within the compositor's
    global co-ordinate space.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    d2156336
  • Daniel Stone's avatar
    shell: Add alpha to weston_curtain_create · e81b8d7c
    Daniel Stone authored
    
    
    Not all solid-colour views want to be opaque: sometimes we use them with
    non-opaque alpha values in order to shade views underneath them.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    e81b8d7c
  • Daniel Stone's avatar
    desktop-shell: Fix opaque region co-ordinate confusion · 791e8b1c
    Daniel Stone authored
    
    
    Opaque regions are in surface co-ordinate space, not global co-ordinate
    space, so the region should be anchored to (0,0).
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    791e8b1c
  • Daniel Stone's avatar
    desktop-shell: Remove redundant geometry dirty call · de0cd532
    Daniel Stone authored
    
    
    Dirtying the geometry only sets a flag on the view saying that the
    geometry is dirty, so we don't need to do it twice back-to-back.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    de0cd532
  • Daniel Stone's avatar
    desktop-shell: Clean up fullscreen black view code · 64ef8755
    Daniel Stone authored
    
    
    Rationalise it a little bit so we don't need pre-declarations of static
    functions, and the order of creation more closely matches the others,
    including making the same calls to explicitly set the output.
    
    Doing this makes the behaviour match the other users of the same code
    pattern. In making them the same, we make desktop-shell code a little
    less magically divergent where people might wonder what the correct
    pattern is to use. After we have moved all users to a uniform pattern,
    later commits are then able to migrate these users to common helper
    code, which reduces code duplication, improves code clarity as it is no
    longer necessary to wonder about the exact semantics of every
    special-case user of this common pattern, and makes it easier to make
    interface changes which improve and clarify the patterns which are
    prevalent throughout the desktop-shell code.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    64ef8755
  • Daniel Stone's avatar
    shell: Make input capture optional for curtains · bd9b0676
    Daniel Stone authored
    
    
    desktop-shell's focus surfaces want to reuse this, but they don't want
    to capture the input, instead allowing it to fall through.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    bd9b0676
  • Daniel Stone's avatar
    desktop-shell: Reuse curtains for focus animations · e031397e
    Daniel Stone authored
    
    
    Just as we do for fullscreen backgrounds, reuse the curtain infrastructure
    for focus animations.
    
    This introduces a small functional change, in that the surface's output
    is no longer directly assigned. Instead, we call
    weston_view_set_output() ourselves. As setting the weston_view's
    position (done from the common helper function of weston_curtain_create
    which has been introduced in previous commits) will call
    weston_view_set_position(), the view's geometry will be dirtied as a
    result.
    
    When the geometry of a weston_view is dirty, it is marked to be updated,
    which will occur whilst traversing the view list during output repaint.
    This occurs for every view which is currently assigned to a layer; when
    building the view list, any view reachable through the view list whose
    geometry is dirty will have its position recalculated and an output
    assigned. Doing so results in the surface's current output being
    updated.
    
    It is believed that there is no functional impact from the
    weston_surface not having a primary output assigned between creation and
    output repaint being called.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    e031397e
  • Daniel Stone's avatar
    shell: Encapsulate weston_curtain in its own struct · dc0f73bc
    Daniel Stone authored
    
    
    This will allow us to create a solid weston_buffer as well, since we
    need to store that separately.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    dc0f73bc
  • Daniel Stone's avatar
    desktop-shell: Reuse curtains for fades · 15a55305
    Daniel Stone authored
    
    
    Use the common infrastructure we have, rather than open-coding again.
    
    In changing to the common weston_curtain infrastructure which was
    introduced in a previous commit, there are two small functional
    derivations.
    
    After adding the view to a layer, we explicitly call
    weston_view_geometry_dirty(). This is believed to have no functional
    impact, as weston_views have their geometry-dirty flag set when they are
    created.
    
    weston_surface_damage() is also called to ensure that the surface is
    scheduled for a repaint. As there is currently no good common mechanic
    in the common code to ensure that output repaint will occur, due to the
    damage propagating outwards from the weston_surface, we are forced to
    call this to predictably ensure that the output will be repainted after
    we have made this change to the scene graph which should result in the
    user observing the new content being repainted.
    
    It is possible that these changes are not strictly required in order for
    the correct behaviour to occur. However, it is felt that explicitly
    adding these calls is perhaps the least fragile way to ensure that the
    behaviour continues to be correct and breakage is not observed,
    especially with both view mapping and surface damage identified as areas
    for future work which could be beneficial to Weston. If it is felt that
    these calls can be removed, then this is certainly possible at a later
    stage.
    
    Lastly, there are many users within desktop-shell of the common pattern
    of creating a weston_curtain and inserting it into the scene graph to be
    painted. These users have been an area of both theoretical concern and
    real-life observed fragility and breakage recently. By making each user
    follow a common and predictable pattern of usage, each user is no longer
    its own special case. This should make it easier to make the
    desktop-shell codebase more robust, not only simplifying the codebase,
    but improving observed behaviour.
    
    In doing this, it is hoped that future structural and interface changes
    become easier to make, allowing us to improve some of the more difficult
    corners of the libweston API.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    15a55305
  • Daniel Stone's avatar
    Move shell-utils to its own directory · 6cb2526b
    Daniel Stone authored
    
    
    shell-utils contains a number of helpers which are currently in use by
    both desktop-shell and kiosk-shell. In order to extend this use to
    fullscreen-shell as well (which can benefit from reusing the
    weston_curtain infrastructure to be able to create solid-colour views
    which may or may not be opaque, as well as one function within
    fullscreen-shell which was copied wholesale to shell-utils), we need to
    create a separate Meson dependency object, and avoid the existing
    pattern of including the source from shared/ within the source list for
    each shell.
    
    This requires creating a new top-level directory for these shared helper
    functions which are required by each shell, but are not part of
    libweston in and of itself.
    
    shell-utils depends on libweston-desktop; libweston-desktop depends on
    libweston; libweston depends on shared.
    
    Thus it is not possible to expose a dependency object from the shared/
    directory which declares a dependency on the libweston-desktop
    dependency, as Meson processes directories in order and resolves
    variable references as they are parsed.
    
    In order to break this deadlock, this commit creates a new top-level
    directory called 'shell-utils' containing only this file, which can be
    parsed by Meson after libweston-desktop (making the libweston-desktop
    Meson dependency variable available to the build file to declare a
    dependency on that), but before the shells (making the new Meson
    depenendency object available to each shell which wishes to use it).
    
    This commit contains no functional changes to any observable code.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    6cb2526b
  • Daniel Stone's avatar
    test/desktop-shell: Use weston_curtain · 577a832f
    Daniel Stone authored
    
    
    Use the helper we have for these, rather than open-coding.
    
    This commit is not believed to result in any functional changes.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    577a832f
  • Daniel Stone's avatar
    fullscreen-shell: Link with shell-utils helpers · b94d69b9
    Daniel Stone authored
    
    
    Unlike desktop-shell and kiosk-shell, the fullscreen-shell does not link
    with the common shell-utils helpers. This is largely because
    fullscreen-shell is largely in 'maintenance mode', seeing little more
    than occasional bug fixes or changes required to accommodate new
    interfaces.
    
    This commit adds a dependency from fullscreen-shell to use the
    shell-utils helper, in order to allow fullscreen-shell to use the new
    weston_curtain infrastructure, rather than continuing to open-code the
    common pattern of creating a surface and view consisting only of a solid
    colour for the background of fullscreen surfaces which do not wholly
    cover the output.
    
    In doing this, the 'surface_subsurfaces_boundingbox()' function is
    removed, as this has been duplicated between the fullscreen-shell and
    the common helper 'library'.
    
    There is no functional change within this commit, as the two functions
    were identical, other than a change to the comment which identifies a
    known bug within this helper.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    b94d69b9
  • Daniel Stone's avatar
    fullscreen-shell: Use weston_curtain for black view · c3415aed
    Daniel Stone authored
    
    
    Use the common helper provided by the shell-utils helper dependency,
    rather than rolling our own.
    
    This commit currently introduces no functional change to
    fullscreen-shell, as the 'curtain' provided by shell-utils behaves
    identically to the previous solid-color surface created by
    fullscreen-shell, given the parameters provided to
    weston_curtain_create().
    
    However, now that a common weston_curtain implementation is being used
    rather than an open-coded variant, future changes to the implementation
    of weston_curtain will result in changes to this code called by
    fullscreen-shell, although it is intended that these will not result in
    any user-visible behavioural changes.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    c3415aed
......@@ -829,7 +829,7 @@ handle_primary_client_destroyed(struct wl_listener *listener, void *data)
static int
weston_create_listening_socket(struct wl_display *display, const char *socket_name)
{
char name_candidate[16];
char name_candidate[32];
if (socket_name) {
if (wl_display_add_socket(display, socket_name)) {
......
......@@ -5,7 +5,6 @@ if get_option('shell-desktop')
'shell.c',
'exposay.c',
'input-panel.c',
'../shared/shell-utils.c',
weston_desktop_shell_server_protocol_h,
weston_desktop_shell_protocol_c,
input_method_unstable_v1_server_protocol_h,
......@@ -17,6 +16,7 @@ if get_option('shell-desktop')
dep_libshared,
dep_lib_desktop,
dep_libweston_public,
dep_shell_utils,
]
plugin_shell_desktop = shared_library(
'desktop-shell',
......
......@@ -41,8 +41,8 @@
#include "weston-desktop-shell-server-protocol.h"
#include <libweston/config-parser.h>
#include "shared/helpers.h"
#include "shared/shell-utils.h"
#include "shared/timespec-util.h"
#include "shell-utils.h"
#include <libweston-desktop/libweston-desktop.h>
#define DEFAULT_NUM_WORKSPACES 1
......@@ -121,7 +121,7 @@ struct shell_surface {
struct {
struct weston_transform transform; /* matrix from x, y */
struct weston_view *black_view;
struct weston_curtain *black_view;
} fullscreen;
struct weston_transform workspace_transform;
......@@ -537,16 +537,10 @@ get_focus_surface(struct weston_surface *surface)
return NULL;
}
static bool
is_focus_surface (struct weston_surface *es)
{
return (es->committed == focus_surface_committed);
}
static bool
is_focus_view (struct weston_view *view)
{
return is_focus_surface (view->surface);
return (view->surface->committed == focus_surface_committed);
}
static struct focus_surface *
......@@ -554,42 +548,25 @@ create_focus_surface(struct weston_compositor *ec,
struct weston_output *output)
{
struct focus_surface *fsurf = NULL;
struct weston_surface *surface = NULL;
struct weston_curtain_params curtain_params = {
.r = 0.0, .g = 0.0, .b = 0.0, .a = 1.0,
.x = output->x, .y = output->y,
.width = output->width, .height = output->height,
.surface_committed = focus_surface_committed,
.get_label = focus_surface_get_label,
.surface_private = NULL,
.capture_input = false,
};
fsurf = malloc(sizeof *fsurf);
if (!fsurf)
return NULL;
fsurf->surface = weston_surface_create(ec);
surface = fsurf->surface;
if (surface == NULL) {
free(fsurf);
return NULL;
}
curtain_params.surface_private = fsurf;
surface->committed = focus_surface_committed;
surface->output = output;
surface->is_mapped = true;
surface->committed_private = fsurf;
weston_surface_set_label_func(surface, focus_surface_get_label);
fsurf->view = weston_view_create(surface);
if (fsurf->view == NULL) {
weston_surface_destroy(surface);
free(fsurf);
return NULL;
}
weston_view_set_output(fsurf->view, output);
fsurf->view->is_mapped = true;
weston_surface_set_size(surface, output->width, output->height);
weston_view_set_position(fsurf->view, output->x, output->y);
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0);
pixman_region32_fini(&surface->opaque);
pixman_region32_init_rect(&surface->opaque, output->x, output->y,
output->width, output->height);
pixman_region32_fini(&surface->input);
pixman_region32_init(&surface->input);
fsurf->curtain = weston_curtain_create(ec, &curtain_params);
weston_view_set_output(fsurf->curtain->view, output);
fsurf->curtain->view->is_mapped = true;
wl_list_init(&fsurf->workspace_transform.link);
......@@ -599,7 +576,7 @@ create_focus_surface(struct weston_compositor *ec,
static void
focus_surface_destroy(struct focus_surface *fsurf)
{
weston_surface_destroy(fsurf->surface);
weston_curtain_destroy(fsurf->curtain);
free(fsurf);
}
......@@ -674,8 +651,8 @@ focus_state_surface_destroy(struct wl_listener *listener, void *data)
weston_view_animation_destroy(state->ws->focus_animation);
state->ws->focus_animation = weston_fade_run(
state->ws->fsurf_front->view,
state->ws->fsurf_front->view->alpha, 0.0, 300,
state->ws->fsurf_front->curtain->view,
state->ws->fsurf_front->curtain->view->alpha, 0.0, 300,
focus_animation_done, state->ws);
}
......@@ -827,19 +804,19 @@ animate_focus_change(struct desktop_shell *shell, struct workspace *ws,
ws->fsurf_front = create_focus_surface(shell->compositor, output);
if (ws->fsurf_front == NULL)
return;
ws->fsurf_front->view->alpha = 0.0;
ws->fsurf_front->curtain->view->alpha = 0.0;
ws->fsurf_back = create_focus_surface(shell->compositor, output);
if (ws->fsurf_back == NULL) {
focus_surface_destroy(ws->fsurf_front);
return;
}
ws->fsurf_back->view->alpha = 0.0;
ws->fsurf_back->curtain->view->alpha = 0.0;
focus_surface_created = true;
} else {
weston_layer_entry_remove(&ws->fsurf_front->view->layer_link);
weston_layer_entry_remove(&ws->fsurf_back->view->layer_link);
weston_layer_entry_remove(&ws->fsurf_front->curtain->view->layer_link);
weston_layer_entry_remove(&ws->fsurf_back->curtain->view->layer_link);
}
if (ws->focus_animation) {
......@@ -849,29 +826,29 @@ animate_focus_change(struct desktop_shell *shell, struct workspace *ws,
if (to)
weston_layer_entry_insert(&to->layer_link,
&ws->fsurf_front->view->layer_link);
&ws->fsurf_front->curtain->view->layer_link);
else if (from)
weston_layer_entry_insert(&ws->layer.view_list,
&ws->fsurf_front->view->layer_link);
&ws->fsurf_front->curtain->view->layer_link);
if (focus_surface_created) {
ws->focus_animation = weston_fade_run(
ws->fsurf_front->view,
ws->fsurf_front->view->alpha, 0.4, 300,
ws->fsurf_front->curtain->view,
ws->fsurf_front->curtain->view->alpha, 0.4, 300,
focus_animation_done, ws);
} else if (from) {
weston_layer_entry_insert(&from->layer_link,
&ws->fsurf_back->view->layer_link);
&ws->fsurf_back->curtain->view->layer_link);
ws->focus_animation = weston_stable_fade_run(
ws->fsurf_front->view, 0.0,
ws->fsurf_back->view, 0.4,
ws->fsurf_front->curtain->view, 0.0,
ws->fsurf_back->curtain->view, 0.4,
focus_animation_done, ws);
} else if (to) {
weston_layer_entry_insert(&ws->layer.view_list,
&ws->fsurf_back->view->layer_link);
&ws->fsurf_back->curtain->view->layer_link);
ws->focus_animation = weston_stable_fade_run(
ws->fsurf_front->view, 0.0,
ws->fsurf_back->view, 0.4,
ws->fsurf_front->curtain->view, 0.0,
ws->fsurf_back->curtain->view, 0.4,
focus_animation_done, ws);
}
}
......@@ -1953,7 +1930,7 @@ unset_fullscreen(struct shell_surface *shsurf)
wl_list_init(&shsurf->fullscreen.transform.link);
if (shsurf->fullscreen.black_view)
weston_surface_destroy(shsurf->fullscreen.black_view->surface);
weston_curtain_destroy(shsurf->fullscreen.black_view);
shsurf->fullscreen.black_view = NULL;
if (shsurf->saved_position_valid)
......@@ -2061,27 +2038,21 @@ black_surface_get_label(struct weston_surface *surface, char *buf, size_t len)
}
static void
black_surface_committed(struct weston_surface *es, int32_t sx, int32_t sy);
static struct weston_view *
create_black_surface(struct weston_compositor *ec,
struct weston_view *fs_view,
float x, float y, int w, int h)
black_surface_committed(struct weston_surface *es, int32_t sx, int32_t sy)
{
struct weston_solid_color_surface surface_data = {};
surface_data.surface_committed = black_surface_committed;
surface_data.get_label = black_surface_get_label;
surface_data.surface_private = fs_view;
surface_data.r = 0;
surface_data.g = 0;
surface_data.b = 0;
}
struct weston_view *view =
create_solid_color_surface(ec, &surface_data, x, y, w, h);
static bool
is_black_surface_view(struct weston_view *view, struct weston_view **fs_view)
{
struct weston_surface *surface = view->surface;
return view;
if (surface->committed == black_surface_committed) {
if (fs_view)
*fs_view = surface->committed_private;
return true;
}
return false;
}
static void
......@@ -2089,26 +2060,35 @@ shell_ensure_fullscreen_black_view(struct shell_surface *shsurf)
{
struct weston_surface *surface =
weston_desktop_surface_get_surface(shsurf->desktop_surface);
struct weston_compositor *ec = surface->compositor;
struct weston_output *output = shsurf->fullscreen_output;
struct weston_curtain_params curtain_params = {
.r = 0.0, .g = 0.0, .b = 0.0, .a = 1.0,
.x = output->x, .y = output->y,
.width = output->width, .height = output->height,
.surface_committed = black_surface_committed,
.get_label = black_surface_get_label,
.surface_private = shsurf->view,
.capture_input = true,
};
struct weston_view *view;
assert(weston_desktop_surface_get_fullscreen(shsurf->desktop_surface));
if (!shsurf->fullscreen.black_view)
if (!shsurf->fullscreen.black_view) {
shsurf->fullscreen.black_view =
create_black_surface(surface->compositor,
shsurf->view,
output->x, output->y,
output->width,
output->height);
weston_view_geometry_dirty(shsurf->fullscreen.black_view);
weston_layer_entry_remove(&shsurf->fullscreen.black_view->layer_link);
weston_layer_entry_insert(&shsurf->view->layer_link,
&shsurf->fullscreen.black_view->layer_link);
weston_view_geometry_dirty(shsurf->fullscreen.black_view);
weston_curtain_create(ec, &curtain_params);
}
view = shsurf->fullscreen.black_view->view;
weston_view_set_output(view, output);
view->is_mapped = true;
weston_layer_entry_remove(&view->layer_link);
weston_layer_entry_insert(&shsurf->view->layer_link, &view->layer_link);
weston_view_geometry_dirty(view);
weston_surface_damage(surface);
shsurf->fullscreen.black_view->is_mapped = true;
shsurf->state.lowered = false;
}
......@@ -2358,7 +2338,7 @@ desktop_surface_removed(struct weston_desktop_surface *desktop_surface,
}
if (shsurf->fullscreen.black_view)
weston_surface_destroy(shsurf->fullscreen.black_view->surface);
weston_curtain_destroy(shsurf->fullscreen.black_view);
weston_surface_set_label_func(surface, NULL);
weston_desktop_surface_set_user_data(shsurf->desktop_surface, NULL);
......@@ -3641,10 +3621,9 @@ lower_fullscreen_layer(struct desktop_shell *shell,
* in the fullscreen layer. */
if (weston_desktop_surface_get_fullscreen(shsurf->desktop_surface)) {
/* Hide the black view */
weston_layer_entry_remove(&shsurf->fullscreen.black_view->layer_link);
wl_list_init(&shsurf->fullscreen.black_view->layer_link.link);
weston_view_damage_below(shsurf->fullscreen.black_view);
weston_layer_entry_remove(&shsurf->fullscreen.black_view->view->layer_link);
wl_list_init(&shsurf->fullscreen.black_view->view->layer_link.link);
weston_view_damage_below(shsurf->fullscreen.black_view->view);
}
/* Lower the view to the workspace layer */
......@@ -3731,25 +3710,6 @@ activate(struct desktop_shell *shell, struct weston_view *view,
}
}
/* no-op func for checking black surface */
static void
black_surface_committed(struct weston_surface *es, int32_t sx, int32_t sy)
{
}
static bool
is_black_surface_view(struct weston_view *view, struct weston_view **fs_view)
{
struct weston_surface *surface = view->surface;
if (surface->committed == black_surface_committed) {
if (fs_view)
*fs_view = surface->committed_private;
return true;
}
return false;
}
static void
activate_binding(struct weston_seat *seat,
struct desktop_shell *shell,
......@@ -3887,8 +3847,8 @@ shell_fade_done_for_output(struct weston_view_animation *animation, void *data)
shell_output->fade.animation = NULL;
switch (shell_output->fade.type) {
case FADE_IN:
weston_surface_destroy(shell_output->fade.view->surface);
shell_output->fade.view = NULL;
weston_curtain_destroy(shell_output->fade.curtain);
shell_output->fade.curtain = NULL;
break;
case FADE_OUT:
lock(shell);
......@@ -3898,33 +3858,35 @@ shell_fade_done_for_output(struct weston_view_animation *animation, void *data)
}
}
static struct weston_view *
shell_fade_create_surface_for_output(struct desktop_shell *shell, struct shell_output *shell_output)
static struct weston_curtain *
shell_fade_create_view_for_output(struct desktop_shell *shell,
struct shell_output *shell_output)
{
struct weston_compositor *compositor = shell->compositor;
struct weston_surface *surface;
struct weston_view *view;
struct weston_output *output = shell_output->output;
struct weston_curtain_params curtain_params = {
.r = 0.0, .g = 0.0, .b = 0.0, .a = 1.0,
.x = output->x, .y = output->y,
.width = output->width, .height = output->height,
.surface_committed = black_surface_committed,
.get_label = black_surface_get_label,
.surface_private = shell_output,
.capture_input = false,
};
struct weston_curtain *curtain;
curtain = weston_curtain_create(compositor, &curtain_params);
assert(curtain);
weston_view_set_output(curtain->view, output);
curtain->view->is_mapped = true;
surface = weston_surface_create(compositor);
if (!surface)
return NULL;
view = weston_view_create(surface);
if (!view) {
weston_surface_destroy(surface);
return NULL;
}
weston_surface_set_size(surface, shell_output->output->width, shell_output->output->height);
weston_view_set_position(view, shell_output->output->x, shell_output->output->y);
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0);
weston_layer_entry_insert(&compositor->fade_layer.view_list,
&view->layer_link);
pixman_region32_init(&surface->input);
surface->is_mapped = true;
view->is_mapped = true;
&curtain->view->layer_link);
weston_view_geometry_dirty(curtain->view);
weston_surface_damage(curtain->view->surface);
return view;
return curtain;
}
static void
......@@ -3949,28 +3911,29 @@ shell_fade(struct desktop_shell *shell, enum fade_type type)
wl_list_for_each(shell_output, &shell->output_list, link) {
shell_output->fade.type = type;
if (shell_output->fade.view == NULL) {
shell_output->fade.view = shell_fade_create_surface_for_output(shell, shell_output);
if (!shell_output->fade.view)
if (shell_output->fade.curtain == NULL) {
shell_output->fade.curtain =
shell_fade_create_view_for_output(shell, shell_output);
if (!shell_output->fade.curtain)
continue;
shell_output->fade.view->alpha = 1.0 - tint;
weston_view_update_transform(shell_output->fade.view);
shell_output->fade.curtain->view->alpha = 1.0 - tint;
weston_view_update_transform(shell_output->fade.curtain->view);
}
if (shell_output->fade.view->output == NULL) {
if (shell_output->fade.curtain->view->output == NULL) {
/* If the black view gets a NULL output, we lost the
* last output and we'll just cancel the fade. This
* happens when you close the last window under the
* X11 or Wayland backends. */
shell->locked = false;
weston_surface_destroy(shell_output->fade.view->surface);
shell_output->fade.view = NULL;
weston_curtain_destroy(shell_output->fade.curtain);
shell_output->fade.curtain = NULL;
} else if (shell_output->fade.animation) {
weston_fade_update(shell_output->fade.animation, tint);
} else {
shell_output->fade.animation =
weston_fade_run(shell_output->fade.view,
weston_fade_run(shell_output->fade.curtain->view,
1.0 - tint, tint, 300.0,
shell_fade_done_for_output, shell_output);
}
......@@ -3990,8 +3953,8 @@ do_shell_fade_startup(void *data)
"unexpected fade-in animation type %d\n",
shell->startup_animation_type);
wl_list_for_each(shell_output, &shell->output_list, link) {
weston_surface_destroy(shell_output->fade.view->surface);
shell_output->fade.view = NULL;
weston_curtain_destroy(shell_output->fade.curtain);
shell_output->fade.curtain = NULL;
}
}
}
......@@ -4042,18 +4005,19 @@ shell_fade_init(struct desktop_shell *shell)
return;
wl_list_for_each(shell_output, &shell->output_list, link) {
if (shell_output->fade.view != NULL) {
if (shell_output->fade.curtain != NULL) {
weston_log("%s: warning: fade surface already exists\n",
__func__);
continue;
}
shell_output->fade.view = shell_fade_create_surface_for_output(shell, shell_output);
if (!shell_output->fade.view)
shell_output->fade.curtain =
shell_fade_create_view_for_output(shell, shell_output);
if (!shell_output->fade.curtain)
continue;
weston_view_update_transform(shell_output->fade.view);
weston_surface_damage(shell_output->fade.view->surface);
weston_view_update_transform(shell_output->fade.curtain->view);
weston_surface_damage(shell_output->fade.curtain->view->surface);
loop = wl_display_get_event_loop(shell->compositor->wl_display);
shell_output->fade.startup_timer =
......@@ -4364,7 +4328,7 @@ switcher_next(struct switcher *switcher)
shsurf = get_shell_surface(switcher->current->surface);
if (shsurf && weston_desktop_surface_get_fullscreen(shsurf->desktop_surface))
shsurf->fullscreen.black_view->alpha = 1.0;
shsurf->fullscreen.black_view->view->alpha = 1.0;
}
static void
......@@ -4707,10 +4671,8 @@ shell_output_destroy(struct shell_output *shell_output)
shell_output->fade.animation = NULL;
}
if (shell_output->fade.view) {
/* destroys the view as well */
weston_surface_destroy(shell_output->fade.view->surface);
}
if (shell_output->fade.curtain)
weston_curtain_destroy(shell_output->fade.curtain);
if (shell_output->fade.startup_timer)
wl_event_source_remove(shell_output->fade.startup_timer);
......@@ -4847,6 +4809,7 @@ desktop_shell_destroy_views_on_layer(struct weston_layer *layer)
wl_list_for_each_safe(view, view_next, &layer->view_list.link, layer_link.link) {
struct shell_surface *shsurf =
get_shell_surface(view->surface);
/* fullscreen_layer is special as it would have a view with an
* additional black_view created and added to its layer_link
* fullscreen view. See shell_ensure_fullscreen_black_view()
......@@ -4856,7 +4819,7 @@ desktop_shell_destroy_views_on_layer(struct weston_layer *layer)
* we do it in desktop_surface_removed() */
if (shsurf)
desktop_shell_destroy_surface(shsurf);
else
else if (is_black_surface_view(view, NULL))
weston_surface_destroy(view->surface);
}
......
......@@ -91,8 +91,7 @@ struct exposay {
};
struct focus_surface {
struct weston_surface *surface;
struct weston_view *view;
struct weston_curtain *curtain;
struct weston_transform workspace_transform;
};
......@@ -121,7 +120,7 @@ struct shell_output {
struct wl_listener background_surface_listener;
struct {
struct weston_view *view;
struct weston_curtain *curtain;
struct weston_view_animation *animation;
enum fade_type type;
struct wl_event_source *startup_timer;
......
......@@ -37,6 +37,7 @@
#include "compositor/weston.h"
#include "fullscreen-shell-unstable-v1-server-protocol.h"
#include "shared/helpers.h"
#include "shell-utils.h"
struct fullscreen_shell {
struct wl_client *client;
......@@ -80,7 +81,7 @@ struct fs_output {
struct weston_surface *surface;
struct wl_listener surface_destroyed;
struct weston_view *view;
struct weston_view *black_view;
struct weston_curtain *curtain;
struct weston_transform transform; /* matrix from x, y */
int presented_for_mode;
......@@ -226,37 +227,27 @@ black_surface_committed(struct weston_surface *es, int32_t sx, int32_t sy)
{
}
static struct weston_view *
create_black_surface(struct weston_compositor *ec, struct fs_output *fsout,
float x, float y, int w, int h)
static struct weston_curtain *
create_curtain(struct weston_compositor *ec, struct fs_output *fsout,
float x, float y, int w, int h)
{
struct weston_surface *surface = NULL;
struct weston_view *view;
struct weston_curtain_params curtain_params = {
.r = 0.0, .g = 0.0, .b = 0.0, .a = 1.0,
.x = x, .y = y, .width = w, .height = h,
.surface_committed = black_surface_committed,
.get_label = NULL,
.surface_private = fsout,
.capture_input = true,
};
struct weston_curtain *curtain;
surface = weston_surface_create(ec);
if (surface == NULL) {
weston_log("no memory\n");
return NULL;
}
view = weston_view_create(surface);
if (!view) {
weston_surface_destroy(surface);
curtain = weston_curtain_create(ec, &curtain_params);
if (!curtain) {
weston_log("no memory\n");
return NULL;
}
surface->committed = black_surface_committed;
surface->committed_private = fsout;
weston_surface_set_color(surface, 0.0f, 0.0f, 0.0f, 1.0f);
pixman_region32_fini(&surface->opaque);
pixman_region32_init_rect(&surface->opaque, 0, 0, w, h);
pixman_region32_fini(&surface->input);
pixman_region32_init_rect(&surface->input, 0, 0, w, h);
weston_surface_set_size(surface, w, h);
weston_view_set_position(view, x, y);
return view;
return curtain;
}
static void
......@@ -333,13 +324,13 @@ fs_output_create(struct fullscreen_shell *shell, struct weston_output *output)
fsout->surface_destroyed.notify = surface_destroyed;
fsout->pending.surface_destroyed.notify = pending_surface_destroyed;
fsout->black_view = create_black_surface(shell->compositor, fsout,
output->x, output->y,
output->width, output->height);
fsout->black_view->surface->is_mapped = true;
fsout->black_view->is_mapped = true;
fsout->curtain = create_curtain(shell->compositor, fsout,
output->x, output->y,
output->width, output->height);
fsout->curtain->view->surface->is_mapped = true;
fsout->curtain->view->is_mapped = true;
weston_layer_entry_insert(&shell->layer.view_list,
&fsout->black_view->layer_link);
&fsout->curtain->view->layer_link);
wl_list_init(&fsout->transform.link);
if (!wl_list_empty(&shell->default_surface_list)) {
......@@ -373,41 +364,6 @@ restore_output_mode(struct weston_output *output)
weston_output_mode_switch_to_native(output);
}
/*
* Returns the bounding box of a surface and all its sub-surfaces,
* in surface-local coordinates. */
static void
surface_subsurfaces_boundingbox(struct weston_surface *surface, int32_t *x,
int32_t *y, int32_t *w, int32_t *h) {
pixman_region32_t region;
pixman_box32_t *box;
struct weston_subsurface *subsurface;
pixman_region32_init_rect(&region, 0, 0,
surface->width,
surface->height);
wl_list_for_each(subsurface, &surface->subsurface_list, parent_link) {
pixman_region32_union_rect(&region, &region,
subsurface->position.x,
subsurface->position.y,
subsurface->surface->width,
subsurface->surface->height);
}
box = pixman_region32_extents(&region);
if (x)
*x = box->x1;
if (y)
*y = box->y1;
if (w)
*w = box->x2 - box->x1;
if (h)
*h = box->y2 - box->y1;
pixman_region32_fini(&region);
}
static void
fs_output_center_view(struct fs_output *fsout)
{
......@@ -520,10 +476,10 @@ fs_output_configure_simple(struct fs_output *fsout,
break;
}
weston_view_set_position(fsout->black_view,
weston_view_set_position(fsout->curtain->view,
fsout->output->x - surf_x,
fsout->output->y - surf_y);
weston_surface_set_size(fsout->black_view->surface,
weston_surface_set_size(fsout->curtain->view->surface,
fsout->output->width,
fsout->output->height);
}
......
......@@ -4,9 +4,10 @@ if get_option('shell-fullscreen')
fullscreen_shell_unstable_v1_server_protocol_h,
fullscreen_shell_unstable_v1_protocol_c,
]
deps_shell_fullscreen=[
deps_shell_fullscreen = [
dep_libweston_public,
dep_libexec_weston,
dep_shell_utils,
]
shared_library(
'fullscreen-shell',
......
......@@ -33,7 +33,7 @@
#include "kiosk-shell-grab.h"
#include "compositor/weston.h"
#include "shared/helpers.h"
#include "shared/shell-utils.h"
#include "shell-utils.h"
#include <libweston/xwayland-api.h>
......@@ -480,13 +480,14 @@ static void
kiosk_shell_output_recreate_background(struct kiosk_shell_output *shoutput)
{
struct kiosk_shell *shell = shoutput->shell;
struct weston_compositor *ec = shell->compositor;
struct weston_output *output = shoutput->output;
struct weston_config_section *shell_section = NULL;
uint32_t bg_color = 0x0;
struct weston_solid_color_surface solid_surface = {};
struct weston_curtain_params curtain_params = {};
if (shoutput->background_view)
weston_surface_destroy(shoutput->background_view->surface);
if (shoutput->curtain)
weston_curtain_destroy(shoutput->curtain);
if (!output)
return;
......@@ -497,31 +498,34 @@ kiosk_shell_output_recreate_background(struct kiosk_shell_output *shoutput)
weston_config_section_get_color(shell_section, "background-color",
&bg_color, 0x00000000);
solid_surface.r = ((bg_color >> 16) & 0xff) / 255.0;
solid_surface.g = ((bg_color >> 8) & 0xff) / 255.0;
solid_surface.b = ((bg_color >> 0) & 0xff) / 255.0;
curtain_params.r = ((bg_color >> 16) & 0xff) / 255.0;
curtain_params.g = ((bg_color >> 8) & 0xff) / 255.0;
curtain_params.b = ((bg_color >> 0) & 0xff) / 255.0;
curtain_params.a = 1.0;
solid_surface.get_label = kiosk_shell_background_surface_get_label;
solid_surface.surface_committed = NULL;
solid_surface.surface_private = NULL;
curtain_params.x = output->x;
curtain_params.y = output->y;
curtain_params.width = output->width;
curtain_params.height = output->height;
shoutput->background_view =
create_solid_color_surface(shoutput->shell->compositor,
&solid_surface,
output->x, output->y,
output->width,
output->height);
curtain_params.capture_input = true;
weston_surface_set_role(shoutput->background_view->surface,
curtain_params.get_label = kiosk_shell_background_surface_get_label;
curtain_params.surface_committed = NULL;
curtain_params.surface_private = NULL;
shoutput->curtain = weston_curtain_create(ec, &curtain_params);
weston_surface_set_role(shoutput->curtain->view->surface,
"kiosk-shell-background", NULL, 0);
weston_layer_entry_insert(&shell->background_layer.view_list,
&shoutput->background_view->layer_link);
&shoutput->curtain->view->layer_link);
shoutput->background_view->is_mapped = true;
shoutput->background_view->surface->is_mapped = true;
shoutput->background_view->surface->output = output;
weston_view_set_output(shoutput->background_view, output);
shoutput->curtain->view->is_mapped = true;
shoutput->curtain->view->surface->is_mapped = true;
shoutput->curtain->view->surface->output = output;
weston_view_set_output(shoutput->curtain->view, output);
}
static void
......@@ -530,8 +534,8 @@ kiosk_shell_output_destroy(struct kiosk_shell_output *shoutput)
shoutput->output = NULL;
shoutput->output_destroy_listener.notify = NULL;
if (shoutput->background_view)
weston_surface_destroy(shoutput->background_view->surface);
if (shoutput->curtain)
weston_curtain_destroy(shoutput->curtain);
wl_list_remove(&shoutput->output_destroy_listener.link);
wl_list_remove(&shoutput->link);
......
......@@ -88,7 +88,7 @@ struct kiosk_shell_seat {
struct kiosk_shell_output {
struct weston_output *output;
struct wl_listener output_destroy_listener;
struct weston_view *background_view;
struct weston_curtain *curtain;
struct kiosk_shell *shell;
struct wl_list link;
......
......@@ -2,7 +2,6 @@ if get_option('shell-kiosk')
srcs_shell_kiosk = [
'kiosk-shell.c',
'kiosk-shell-grab.c',
'../shared/shell-utils.c',
weston_desktop_shell_server_protocol_h,
weston_desktop_shell_protocol_c,
input_method_unstable_v1_server_protocol_h,
......@@ -14,6 +13,7 @@ if get_option('shell-kiosk')
dep_libshared,
dep_lib_desktop,
dep_libweston_public,
dep_shell_utils,
]
plugin_shell_kiosk = shared_library(
'kiosk-shell',
......
......@@ -505,6 +505,9 @@ static const struct pixel_format_info pixel_format_table[] = {
.num_planes = 3,
.chroma_order = ORDER_VU,
},
{
DRM_FORMAT(XYUV8888),
},
};
WL_EXPORT const struct pixel_format_info *
......
......@@ -171,6 +171,7 @@ subdir('libweston')
subdir('libweston-desktop')
subdir('xwayland')
subdir('compositor')
subdir('shell-utils')
subdir('desktop-shell')
subdir('fullscreen-shell')
subdir('ivi-shell')
......
dep_shell_utils = declare_dependency(
sources: 'shell-utils.c',
include_directories: include_directories('.'),
dependencies: dep_lib_desktop
)
......@@ -25,7 +25,7 @@
*/
#include "config.h"
#include "shared/shell-utils.h"
#include "shell-utils.h"
#include <libweston-desktop/libweston-desktop.h>
struct weston_output *
......@@ -138,38 +138,71 @@ surface_get_label(struct weston_surface *surface, char *buf, size_t len)
c ? " of " : "", c ?: "");
}
struct weston_view *
create_solid_color_surface(struct weston_compositor *compositor,
struct weston_solid_color_surface *ss,
float x, float y, int w, int h)
struct weston_curtain *
weston_curtain_create(struct weston_compositor *compositor,
struct weston_curtain_params *params)
{
struct weston_curtain *curtain;
struct weston_surface *surface = NULL;
struct weston_view *view;
curtain = zalloc(sizeof(*curtain));
if (curtain == NULL)
goto err;
surface = weston_surface_create(compositor);
if (surface == NULL) {
weston_log("no memory\n");
return NULL;
}
if (surface == NULL)
goto err_curtain;
view = weston_view_create(surface);
if (view == NULL) {
weston_log("no memory\n");
weston_surface_destroy(surface);
return NULL;
}
if (view == NULL)
goto err_surface;
surface->committed = params->surface_committed;
surface->committed_private = params->surface_private;
surface->committed = ss->surface_committed;
surface->committed_private = ss->surface_private;
curtain->view = view;
weston_surface_set_color(surface,
params->r, params->g, params->b, params->a);
weston_surface_set_label_func(surface, params->get_label);
weston_surface_set_color(surface, ss->r, ss->g, ss->b, 1.0);
weston_surface_set_label_func(surface, ss->get_label);
pixman_region32_fini(&surface->opaque);
pixman_region32_init_rect(&surface->opaque, 0, 0, w, h);
if (params->a == 1.0) {
pixman_region32_init_rect(&surface->opaque, 0, 0,
params->width, params->height);
} else {
pixman_region32_init(&surface->opaque);
}
pixman_region32_fini(&surface->input);
pixman_region32_init_rect(&surface->input, 0, 0, w, h);
if (params->capture_input) {
pixman_region32_init_rect(&surface->input, 0, 0,
params->width, params->height);
} else {
pixman_region32_init(&surface->input);
}
weston_surface_set_size(surface, w, h);
weston_view_set_position(view, x, y);
weston_surface_set_size(surface, params->width, params->height);
weston_view_set_position(view, params->x, params->y);
return curtain;
err_surface:
weston_surface_destroy(surface);
err_curtain:
free(curtain);
err:
weston_log("no memory\n");
return NULL;
}
void
weston_curtain_destroy(struct weston_curtain *curtain)
{
struct weston_surface *surface = curtain->view->surface;
return view;
weston_view_destroy(curtain->view);
weston_surface_destroy(surface);
free(curtain);
}
......@@ -26,12 +26,18 @@
#include "shared/helpers.h"
#include <libweston/libweston.h>
/* parameter for create_solid_color_surface() */
struct weston_solid_color_surface {
/* parameter for weston_curtain_create() */
struct weston_curtain_params {
int (*get_label)(struct weston_surface *es, char *buf, size_t len);
void (*surface_committed)(struct weston_surface *es, int32_t sx, int32_t sy);
void *surface_private;
float r, g, b;
float r, g, b, a;
int x, y, width, height;
bool capture_input;
};
struct weston_curtain {
struct weston_view *view;
};
struct weston_output *
......@@ -50,9 +56,9 @@ surface_subsurfaces_boundingbox(struct weston_surface *surface, int32_t *x,
int
surface_get_label(struct weston_surface *surface, char *buf, size_t len);
/* helper to create a view w/ a color
*/
struct weston_view *
create_solid_color_surface(struct weston_compositor *compositor,
struct weston_solid_color_surface *ss,
float x, float y, int w, int h);
/* helper to create a view w/ a color */
struct weston_curtain *
weston_curtain_create(struct weston_compositor *compositor,
struct weston_curtain_params *params);
void
weston_curtain_destroy(struct weston_curtain *curtain);
......@@ -2,7 +2,7 @@ plugin_test_shell_desktop = shared_library(
'weston-test-desktop-shell',
'weston-test-desktop-shell.c',
include_directories: common_inc,
dependencies: [ dep_lib_desktop, dep_libweston_public, dep_libexec_weston ],
dependencies: [ dep_lib_desktop, dep_libweston_public, dep_libexec_weston, dep_shell_utils ],
name_prefix: '',
install: false
)
......@@ -217,9 +217,8 @@ tests = [
{ 'name': 'safe-signal-output-removal',
'sources': [
'safe-signal-output-removal-test.c',
'../shared/shell-utils.c',
],
'dep_objs': [ dep_lib_desktop ]
'dep_objs': [ dep_lib_desktop, dep_shell_utils ]
},
]
......
......@@ -30,7 +30,7 @@
#include <stdio.h>
#include "../shared/signal.h"
#include "../shared/shell-utils.h"
#include "shell-utils.h"
#include "weston-test-client-helper.h"
#include "weston-test-fixture-compositor.h"
......@@ -38,7 +38,7 @@ struct test_output {
struct weston_compositor *compositor;
struct weston_output *output;
struct wl_listener output_destroy_listener;
struct weston_view *view;
struct weston_curtain *curtain;
};
static enum test_result_code
......@@ -60,8 +60,8 @@ output_destroy(struct test_output *t_output)
t_output->output = NULL;
t_output->output_destroy_listener.notify = NULL;
if (t_output->view)
weston_surface_destroy(t_output->view->surface);
if (t_output->curtain)
weston_curtain_destroy(t_output->curtain);
wl_list_remove(&t_output->output_destroy_listener.link);
free(t_output);
......@@ -79,20 +79,18 @@ notify_output_destroy(struct wl_listener *listener, void *data)
static void
output_create_view(struct test_output *t_output)
{
struct weston_solid_color_surface solid_surface = {};
solid_surface.r = 0.5;
solid_surface.g = 0.5;
solid_surface.b = 0.5;
solid_surface.get_label = NULL;
solid_surface.surface_committed = NULL;
solid_surface.surface_private = NULL;
t_output->view =
create_solid_color_surface(t_output->compositor,
&solid_surface, 0, 0, 320, 240);
weston_view_set_output(t_output->view, t_output->output);
struct weston_curtain_params curtain_params = {
.r = 0.5, .g = 0.5, .b = 0.5, .a = 1.0,
.x = 0, .y = 0,
.width = 320, .height = 240,
.get_label = NULL,
.surface_committed = NULL,
.surface_private = NULL,
};
t_output->curtain = weston_curtain_create(t_output->compositor,
&curtain_params);
weston_view_set_output(t_output->curtain->view, t_output->output);
/* weston_compositor_remove_output() has to be patched with
* weston_signal_emit_mutable() to avoid signal corruption */
......
......@@ -39,14 +39,14 @@
#include "compositor/weston.h"
#include <libweston/config-parser.h>
#include "shared/helpers.h"
#include "shell-utils.h"
#include <libweston-desktop/libweston-desktop.h>
struct desktest_shell {
struct wl_listener compositor_destroy_listener;
struct weston_desktop *desktop;
struct weston_layer background_layer;
struct weston_surface *background_surface;
struct weston_view *background_view;
struct weston_curtain *background;
struct weston_layer layer;
struct weston_view *view;
};
......@@ -174,8 +174,7 @@ shell_destroy(struct wl_listener *listener, void *data)
wl_list_remove(&dts->compositor_destroy_listener.link);
weston_desktop_destroy(dts->desktop);
weston_view_destroy(dts->background_view);
weston_surface_destroy(dts->background_surface);
weston_curtain_destroy(dts->background);
weston_layer_fini(&dts->layer);
weston_layer_fini(&dts->background_layer);
......@@ -188,6 +187,14 @@ wet_shell_init(struct weston_compositor *ec,
int *argc, char *argv[])
{
struct desktest_shell *dts;
struct weston_curtain_params background_params = {
.r = 0.16, .g = 0.32, .b = 0.48, .a = 1.0,
.x = 0, .y = 0, .width = 2000, .height = 2000,
.capture_input = true,
.surface_committed = NULL,
.get_label = background_get_label,
.surface_private = NULL,
};
dts = zalloc(sizeof *dts);
if (!dts)
......@@ -208,28 +215,16 @@ wet_shell_init(struct weston_compositor *ec,
weston_layer_set_position(&dts->background_layer,
WESTON_LAYER_POSITION_BACKGROUND);
dts->background_surface = weston_surface_create(ec);
if (dts->background_surface == NULL)
dts->background = weston_curtain_create(ec, &background_params);
if (dts->background == NULL)
goto out_free;
dts->background_view = weston_view_create(dts->background_surface);
if (dts->background_view == NULL)
goto out_surface;
weston_surface_set_role(dts->background_surface,
weston_surface_set_role(dts->background->view->surface,
"test-desktop background", NULL, 0);
weston_surface_set_label_func(dts->background_surface,
background_get_label);
weston_surface_set_color(dts->background_surface, 0.16, 0.32, 0.48, 1.);
pixman_region32_fini(&dts->background_surface->opaque);
pixman_region32_init_rect(&dts->background_surface->opaque, 0, 0, 2000, 2000);
pixman_region32_fini(&dts->background_surface->input);
pixman_region32_init_rect(&dts->background_surface->input, 0, 0, 2000, 2000);
weston_surface_set_size(dts->background_surface, 2000, 2000);
weston_view_set_position(dts->background_view, 0, 0);
weston_layer_entry_insert(&dts->background_layer.view_list, &dts->background_view->layer_link);
weston_view_update_transform(dts->background_view);
weston_view_set_position(dts->background->view, 0, 0);
weston_layer_entry_insert(&dts->background_layer.view_list,
&dts->background->view->layer_link);
weston_view_update_transform(dts->background->view);
dts->desktop = weston_desktop_create(ec, &shell_desktop_api, dts);
if (dts->desktop == NULL)
......@@ -240,10 +235,7 @@ wet_shell_init(struct weston_compositor *ec,
return 0;
out_view:
weston_view_destroy(dts->background_view);
out_surface:
weston_surface_destroy(dts->background_surface);
weston_curtain_destroy(dts->background);
out_free:
wl_list_remove(&dts->compositor_destroy_listener.link);
......