Skip to content
Commits on Source (11)
......@@ -1586,7 +1586,7 @@ int main(int argc, char *argv[])
if (desktop.want_panel)
weston_desktop_shell_set_panel_position(desktop.shell, desktop.panel_position);
wl_list_for_each(output, &desktop.outputs, link)
if (!output->panel)
if (!output->background)
output_init(output, &desktop);
grab_surface_create(&desktop);
......
......@@ -1287,6 +1287,11 @@ int main(int argc, char **argv)
wlCtx_WorkSpaceBackGround.cmm = &wlCtxCommon;
/* create desktop widgets */
create_launchers(&wlCtxCommon, &hmi_setting->launcher_list);
create_workspace_background(&wlCtx_WorkSpaceBackGround,
&hmi_setting->workspace_background);
for (i = 0; i < hmi_setting->screen_num; i++) {
wlCtx_BackGround[i].cmm = &wlCtxCommon;
create_background(&wlCtx_BackGround[i],
......@@ -1312,11 +1317,6 @@ int main(int argc, char **argv)
create_button(&wlCtx_Button_4, hmi_setting->random.id,
hmi_setting->random.filePath, 3);
create_workspace_background(&wlCtx_WorkSpaceBackGround,
&hmi_setting->workspace_background);
create_launchers(&wlCtxCommon, &hmi_setting->launcher_list);
create_home_button(&wlCtx_HomeButton, hmi_setting->home.id,
hmi_setting->home.filePath);
......
......@@ -3459,11 +3459,7 @@ surface_opacity_binding(struct weston_pointer *pointer,
return;
shsurf->view->alpha -= event->value * step;
if (shsurf->view->alpha > 1.0)
shsurf->view->alpha = 1.0;
if (shsurf->view->alpha < step)
shsurf->view->alpha = step;
shsurf->view->alpha = CLIP(shsurf->view->alpha, step, 1.0);
weston_view_geometry_dirty(shsurf->view);
weston_surface_damage(surface);
......
......@@ -583,9 +583,25 @@ set_notification_remove_surface(struct wl_listener *listener, void *data)
struct hmi_controller *hmi_ctrl =
wl_container_of(listener, hmi_ctrl,
surface_removed);
(void)data;
struct ivi_layout_surface *ivisurf = data;
switch_mode(hmi_ctrl, hmi_ctrl->layout_mode);
/* set focus */
if (hmi_ctrl->interface->surface_is_active(ivisurf)) {
struct ivi_layout_surface **pp_surface = NULL;
int32_t surface_length = 0;
int32_t i;
hmi_ctrl->interface->get_surfaces(&surface_length, &pp_surface);
for (i = 0; i < surface_length; i++) {
if (pp_surface[i] != ivisurf) {
hmi_ctrl->interface->surface_activate(pp_surface[i]);
break;
}
}
}
}
static void
......@@ -643,6 +659,9 @@ set_notification_configure_surface(struct wl_listener *listener, void *data)
ivisurfs = NULL;
}
hmi_ctrl->interface->layer_add_surface(application_layer, ivisurf);
hmi_ctrl->interface->surface_activate(ivisurf);
switch_mode(hmi_ctrl, hmi_ctrl->layout_mode);
}
......@@ -678,7 +697,9 @@ set_notification_configure_desktop_surface(struct wl_listener *listener, void *d
0, surface->width, surface->height);
}
hmi_ctrl->interface->surface_activate(ivisurf);
hmi_ctrl->interface->commit_changes();
switch_mode(hmi_ctrl, hmi_ctrl->layout_mode);
}
......
......@@ -330,6 +330,18 @@ struct ivi_layout_interface {
int32_t (*surface_set_id)(struct ivi_layout_surface *ivisurf,
uint32_t id_surface);
/**
* \brief activate ivi_layout_surface
*
* The surface must be added to a layer before it can be activated.
*/
void (*surface_activate)(struct ivi_layout_surface *ivisurf);
/**
* \brief check if ivi_layout_surface is active
*/
bool (*surface_is_active)(struct ivi_layout_surface *ivisurf);
/**
* layer controller interface
*/
......
......@@ -55,6 +55,8 @@ struct ivi_layout_surface {
struct weston_surface *surface;
struct weston_desktop_surface *weston_desktop_surface;
int focus_count;
struct ivi_layout_view *ivi_view;
struct ivi_layout_surface_properties prop;
......
......@@ -76,6 +76,11 @@ void
ivi_layout_surface_configure(struct ivi_layout_surface *ivisurf,
int32_t width, int32_t height);
void
ivi_layout_surface_activate_with_seat(struct ivi_layout_surface *ivisurf,
struct weston_seat *seat,
uint32_t activate_flags);
struct ivi_layout_surface*
ivi_layout_surface_create(struct weston_surface *wl_surface,
uint32_t id_surface);
......
......@@ -1785,6 +1785,67 @@ ivi_layout_surface_set_id(struct ivi_layout_surface *ivisurf,
return IVI_SUCCEEDED;
}
static void
deactivate_current_surface(struct weston_seat *seat)
{
struct ivi_layout_surface *ivisurf =
shell_get_focused_ivi_layout_surface(seat);
struct weston_desktop_surface *desktop_surface;
if (!ivisurf)
return;
shell_set_focused_ivi_layout_surface(NULL, seat);
desktop_surface = ivisurf->weston_desktop_surface;
if (--ivisurf->focus_count == 0 && desktop_surface)
weston_desktop_surface_set_activated(desktop_surface, false);
}
static void
surface_activate(struct ivi_layout_surface *ivisurf, struct weston_seat *seat)
{
struct weston_desktop_surface *dsurf = ivisurf->weston_desktop_surface;
deactivate_current_surface(seat);
shell_set_focused_ivi_layout_surface(ivisurf, seat);
if (ivisurf->focus_count++ == 0 && dsurf)
weston_desktop_surface_set_activated(dsurf, true);
}
static void
ivi_layout_surface_activate(struct ivi_layout_surface *ivisurf)
{
struct weston_seat *seat;
assert(ivisurf->ivi_view);
wl_list_for_each(seat, &ivisurf->surface->compositor->seat_list, link) {
weston_view_activate_input(ivisurf->ivi_view->view, seat,
WESTON_ACTIVATE_FLAG_NONE);
surface_activate(ivisurf, seat);
}
}
static bool
ivi_layout_surface_is_active(struct ivi_layout_surface *ivisurf)
{
assert(ivisurf);
return (ivisurf->focus_count > 0);
}
void
ivi_layout_surface_activate_with_seat(struct ivi_layout_surface *ivisurf,
struct weston_seat *seat,
uint32_t activate_flags)
{
weston_view_activate_input(ivisurf->ivi_view->view,
seat, activate_flags);
surface_activate(ivisurf, seat);
}
static void
ivi_layout_surface_set_transition(struct ivi_layout_surface *ivisurf,
enum ivi_layout_transition_type type,
......@@ -2132,6 +2193,8 @@ static struct ivi_layout_interface ivi_layout_interface = {
.surface_set_transition = ivi_layout_surface_set_transition,
.surface_set_transition_duration = ivi_layout_surface_set_transition_duration,
.surface_set_id = ivi_layout_surface_set_id,
.surface_activate = ivi_layout_surface_activate,
.surface_is_active = ivi_layout_surface_is_active,
/**
* layer controller interfaces
......
......@@ -95,6 +95,14 @@ struct ivi_input_panel_surface
struct wl_list link;
};
struct ivi_shell_seat {
struct weston_seat *seat;
struct wl_listener seat_destroy_listener;
struct ivi_layout_surface *focused_ivisurf;
struct wl_list link; /** ivi_shell::seat_list */
};
/*
* Implementation of ivi_surface
*/
......@@ -128,6 +136,43 @@ shell_get_ivi_layout_surface(struct weston_surface *surface)
return shsurf->layout_surface;
}
static void
ivi_shell_seat_handle_destroy(struct wl_listener *listener, void *data);
static struct ivi_shell_seat *
get_ivi_shell_seat(struct weston_seat *seat)
{
struct wl_listener *listener;
if (!seat)
return NULL;
listener = wl_signal_get(&seat->destroy_signal,
ivi_shell_seat_handle_destroy);
if (!listener)
return NULL;
return container_of(listener, struct ivi_shell_seat,
seat_destroy_listener);
}
struct ivi_layout_surface *
shell_get_focused_ivi_layout_surface(struct weston_seat *seat)
{
struct ivi_shell_seat *shseat = get_ivi_shell_seat(seat);
return shseat->focused_ivisurf;
}
void
shell_set_focused_ivi_layout_surface(struct ivi_layout_surface *ivisurf,
struct weston_seat *seat)
{
struct ivi_shell_seat *shseat = get_ivi_shell_seat(seat);
shseat->focused_ivisurf = ivisurf;
}
void
shell_surface_send_configure(struct weston_surface *surface,
int32_t width, int32_t height)
......@@ -175,12 +220,19 @@ ivi_shell_surface_get_label(struct weston_surface *surface,
static void
layout_surface_cleanup(struct ivi_shell_surface *ivisurf)
{
struct weston_seat *seat;
assert(ivisurf->layout_surface != NULL);
/* destroy weston_surface destroy signal. */
if (!ivisurf->layout_surface->weston_desktop_surface)
wl_list_remove(&ivisurf->surface_destroy_listener.link);
wl_list_for_each(seat, &ivisurf->surface->compositor->seat_list, link) {
struct ivi_shell_seat *shseat = get_ivi_shell_seat(seat);
if (shseat->focused_ivisurf == ivisurf->layout_surface)
shseat->focused_ivisurf = NULL;
}
ivi_layout_surface_destroy(ivisurf->layout_surface);
ivisurf->layout_surface = NULL;
......@@ -357,6 +409,44 @@ bind_ivi_application(struct wl_client *client,
shell, NULL);
}
/*
* ivi_shell_seat
*/
static void
ivi_shell_seat_destroy(struct ivi_shell_seat *shseat)
{
wl_list_remove(&shseat->seat_destroy_listener.link);
wl_list_remove(&shseat->link);
free(shseat);
}
static void
ivi_shell_seat_handle_destroy(struct wl_listener *listener, void *data)
{
struct ivi_shell_seat *shseat = container_of(listener,
struct ivi_shell_seat,
seat_destroy_listener);
ivi_shell_seat_destroy(shseat);
}
static struct ivi_shell_seat *
ivi_shell_seat_create(struct ivi_shell *shell, struct weston_seat *seat)
{
struct ivi_shell_seat *shseat;
shseat = xzalloc(sizeof *shseat);
shseat->seat = seat;
shseat->seat_destroy_listener.notify = ivi_shell_seat_handle_destroy;
wl_signal_add(&seat->destroy_signal, &shseat->seat_destroy_listener);
wl_list_insert(&shell->seat_list, &shseat->link);
return shseat;
}
void
input_panel_destroy(struct ivi_shell *shell);
......@@ -369,11 +459,13 @@ shell_destroy(struct wl_listener *listener, void *data)
struct ivi_shell *shell =
container_of(listener, struct ivi_shell, destroy_listener);
struct ivi_shell_surface *ivisurf, *next;
struct ivi_shell_seat *shseat, *shseat_next;
ivi_layout_ivi_shell_destroy();
wl_list_remove(&shell->destroy_listener.link);
wl_list_remove(&shell->wake_listener.link);
wl_list_remove(&shell->seat_created_listener.link);
if (shell->text_backend) {
text_backend_destroy(shell->text_backend);
......@@ -387,6 +479,9 @@ shell_destroy(struct wl_listener *listener, void *data)
free(ivisurf);
}
wl_list_for_each_safe(shseat, shseat_next, &shell->seat_list, link)
ivi_shell_seat_destroy(shseat);
ivi_layout_fini();
weston_desktop_destroy(shell->desktop);
......@@ -473,9 +568,8 @@ activate_binding(struct weston_seat *seat,
return;
}
/* FIXME: need to activate the surface like
kiosk_shell_surface_activate() */
weston_view_activate_input(focus_view, seat, flags);
ivi_layout_surface_activate_with_seat(ivisurf->layout_surface, seat,
flags);
}
static void
......@@ -706,6 +800,16 @@ static const struct weston_desktop_api shell_desktop_api = {
.set_xwayland_position = desktop_surface_set_xwayland_position,
};
static void
ivi_shell_handle_seat_created(struct wl_listener *listener, void *data)
{
struct weston_seat *seat = data;
struct ivi_shell *shell =
container_of(listener, struct ivi_shell, seat_created_listener);
ivi_shell_seat_create(shell, seat);
}
/*
* end of libweston-desktop
*/
......@@ -1042,6 +1146,7 @@ wet_shell_init(struct weston_compositor *compositor,
int *argc, char *argv[])
{
struct ivi_shell *shell;
struct weston_seat *seat;
shell = xzalloc(sizeof *shell);
......@@ -1066,6 +1171,13 @@ wet_shell_init(struct weston_compositor *compositor,
shell, bind_ivi_application) == NULL)
goto err_desktop;
wl_list_init(&shell->seat_list);
wl_list_for_each(seat, &compositor->seat_list, link)
ivi_shell_seat_create(shell, seat);
shell->seat_created_listener.notify = ivi_shell_handle_seat_created;
wl_signal_add(&compositor->seat_created_signal,
&shell->seat_created_listener);
ivi_layout_init(compositor, shell);
screenshooter_create(compositor);
......
......@@ -39,6 +39,7 @@ struct ivi_shell
struct wl_listener show_input_panel_listener;
struct wl_listener hide_input_panel_listener;
struct wl_listener update_input_panel_listener;
struct wl_listener seat_created_listener;
struct weston_compositor *compositor;
......@@ -52,6 +53,8 @@ struct ivi_shell
struct wl_resource *binding;
struct wl_list surfaces;
} input_panel;
struct wl_list seat_list;
};
void
......@@ -63,6 +66,13 @@ struct ivi_layout_surface;
struct ivi_layout_surface *
shell_get_ivi_layout_surface(struct weston_surface *surface);
struct ivi_layout_surface *
shell_get_focused_ivi_layout_surface(struct weston_seat *seat);
void
shell_set_focused_ivi_layout_surface(struct ivi_layout_surface *ivisurface,
struct weston_seat *seat);
void
shell_ensure_text_input(struct ivi_shell *shell);
bool
......
......@@ -75,56 +75,78 @@ static void
drm_backend_create_faked_zpos(struct drm_device *device)
{
struct drm_backend *b = device->backend;
struct drm_plane *plane;
struct drm_plane *plane, *tmp;
struct wl_list tmp_list;
uint64_t zpos = 0ULL;
uint64_t zpos_min_primary;
uint64_t zpos_min_overlay;
uint64_t zpos_min_cursor;
zpos_min_primary = zpos;
/* if the property is there, bail out sooner */
wl_list_for_each(plane, &device->plane_list, link) {
/* if the property is there, bail out sooner */
if (plane->props[WDRM_PLANE_ZPOS].prop_id != 0)
return;
}
drm_debug(b, "[drm-backend] zpos property not found. "
"Using invented immutable zpos values:\n");
wl_list_init(&tmp_list);
wl_list_insert_list(&tmp_list, &device->plane_list);
wl_list_init(&device->plane_list);
zpos_min_primary = zpos;
wl_list_for_each_safe(plane, tmp, &tmp_list, link) {
if (plane->type != WDRM_PLANE_TYPE_PRIMARY)
continue;
plane->zpos_min = zpos_min_primary;
plane->zpos_max = zpos_min_primary;
wl_list_remove(&plane->link);
wl_list_insert(&device->plane_list, &plane->link);
zpos++;
drm_debug(b, "\t[plane] %s plane %d, zpos_min %"PRIu64", "
"zpos_max %"PRIu64"\n",
drm_output_get_plane_type_name(plane),
plane->plane_id, plane->zpos_min, plane->zpos_max);
}
zpos_min_overlay = zpos;
wl_list_for_each(plane, &device->plane_list, link) {
wl_list_for_each_safe(plane, tmp, &tmp_list, link) {
if (plane->type != WDRM_PLANE_TYPE_OVERLAY)
continue;
plane->zpos_min = zpos_min_overlay;
plane->zpos_max = zpos_min_overlay;
wl_list_remove(&plane->link);
wl_list_insert(&device->plane_list, &plane->link);
zpos++;
drm_debug(b, "\t[plane] %s plane %d, zpos_min %"PRIu64", "
"zpos_max %"PRIu64"\n",
drm_output_get_plane_type_name(plane),
plane->plane_id, plane->zpos_min, plane->zpos_max);
}
zpos_min_cursor = zpos;
wl_list_for_each(plane, &device->plane_list, link) {
wl_list_for_each_safe(plane, tmp, &tmp_list, link) {
if (plane->type != WDRM_PLANE_TYPE_CURSOR)
continue;
plane->zpos_min = zpos_min_cursor;
plane->zpos_max = zpos_min_cursor;
wl_list_remove(&plane->link);
wl_list_insert(&device->plane_list, &plane->link);
zpos++;
}
drm_debug(b, "[drm-backend] zpos property not found. "
"Using invented immutable zpos values:\n");
/* assume that invented zpos values are immutable */
wl_list_for_each(plane, &device->plane_list, link) {
if (plane->type == WDRM_PLANE_TYPE_PRIMARY) {
plane->zpos_min = zpos_min_primary;
plane->zpos_max = zpos_min_primary;
} else if (plane->type == WDRM_PLANE_TYPE_OVERLAY) {
plane->zpos_min = zpos_min_overlay;
plane->zpos_max = zpos_min_overlay;
} else if (plane->type == WDRM_PLANE_TYPE_CURSOR) {
plane->zpos_min = zpos_min_cursor;
plane->zpos_max = zpos_min_cursor;
}
drm_debug(b, "\t[plane] %s plane %d, zpos_min %"PRIu64", "
"zpos_max %"PRIu64"\n",
drm_output_get_plane_type_name(plane),
plane->plane_id, plane->zpos_min, plane->zpos_max);
}
assert(wl_list_empty(&tmp_list));
}
static int
......
......@@ -566,6 +566,7 @@ drm_output_find_plane_for_view(struct drm_output_state *state,
/* if the view covers the whole output, put it in the
* scanout plane, not overlay */
if (view_matches_entire_output &&
weston_view_is_opaque(ev, &ev->transform.boundingbox) &&
!scanout_has_view_assigned)
continue;
break;
......
......@@ -538,6 +538,9 @@ weston_desktop_seat_popup_grab_add_surface(struct weston_desktop_seat *seat,
wl_list_insert(&seat->popup_grab.surfaces, link);
if (!seat->popup_grab.keyboard.keyboard)
return;
desktop_surface =
weston_desktop_seat_popup_grab_get_topmost_surface(seat);
surface = weston_desktop_surface_get_surface(desktop_surface);
......@@ -558,6 +561,9 @@ weston_desktop_seat_popup_grab_remove_surface(struct weston_desktop_seat *seat,
struct weston_desktop_surface *desktop_surface;
struct weston_surface *surface;
if (!seat->popup_grab.keyboard.keyboard)
return;
desktop_surface =
weston_desktop_seat_popup_grab_get_topmost_surface(seat);
surface = weston_desktop_surface_get_surface(desktop_surface);
......
......@@ -888,6 +888,8 @@ weston_desktop_surface_foreach_child(struct weston_desktop_surface *surface,
{
struct weston_desktop_surface *child;
wl_list_for_each(child, &surface->children_list, children_link)
callback(child, user_data);
wl_list_for_each(child, &surface->children_list, children_link) {
if (weston_desktop_surface_get_user_data(child))
callback(child, user_data);
}
}