mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-04 22:52:51 +00:00
ivi-shell: activate desktop surface
The keyboard focus is active, but the desktop surface itself is not displayed as active. Therefore, the surface should also be displayed as active, as in kiosk-shell. Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
This commit is contained in:
parent
ec3e2d2d36
commit
0e082315d7
|
@ -330,6 +330,18 @@ struct ivi_layout_interface {
|
||||||
int32_t (*surface_set_id)(struct ivi_layout_surface *ivisurf,
|
int32_t (*surface_set_id)(struct ivi_layout_surface *ivisurf,
|
||||||
uint32_t id_surface);
|
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
|
* layer controller interface
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -55,6 +55,8 @@ struct ivi_layout_surface {
|
||||||
struct weston_surface *surface;
|
struct weston_surface *surface;
|
||||||
struct weston_desktop_surface *weston_desktop_surface;
|
struct weston_desktop_surface *weston_desktop_surface;
|
||||||
|
|
||||||
|
int focus_count;
|
||||||
|
|
||||||
struct ivi_layout_view *ivi_view;
|
struct ivi_layout_view *ivi_view;
|
||||||
|
|
||||||
struct ivi_layout_surface_properties prop;
|
struct ivi_layout_surface_properties prop;
|
||||||
|
|
|
@ -76,6 +76,11 @@ void
|
||||||
ivi_layout_surface_configure(struct ivi_layout_surface *ivisurf,
|
ivi_layout_surface_configure(struct ivi_layout_surface *ivisurf,
|
||||||
int32_t width, int32_t height);
|
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*
|
struct ivi_layout_surface*
|
||||||
ivi_layout_surface_create(struct weston_surface *wl_surface,
|
ivi_layout_surface_create(struct weston_surface *wl_surface,
|
||||||
uint32_t id_surface);
|
uint32_t id_surface);
|
||||||
|
|
|
@ -1776,6 +1776,67 @@ ivi_layout_surface_set_id(struct ivi_layout_surface *ivisurf,
|
||||||
return IVI_SUCCEEDED;
|
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
|
static void
|
||||||
ivi_layout_surface_set_transition(struct ivi_layout_surface *ivisurf,
|
ivi_layout_surface_set_transition(struct ivi_layout_surface *ivisurf,
|
||||||
enum ivi_layout_transition_type type,
|
enum ivi_layout_transition_type type,
|
||||||
|
@ -2123,6 +2184,8 @@ static struct ivi_layout_interface ivi_layout_interface = {
|
||||||
.surface_set_transition = ivi_layout_surface_set_transition,
|
.surface_set_transition = ivi_layout_surface_set_transition,
|
||||||
.surface_set_transition_duration = ivi_layout_surface_set_transition_duration,
|
.surface_set_transition_duration = ivi_layout_surface_set_transition_duration,
|
||||||
.surface_set_id = ivi_layout_surface_set_id,
|
.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
|
* layer controller interfaces
|
||||||
|
|
|
@ -98,6 +98,7 @@ struct ivi_input_panel_surface
|
||||||
struct ivi_shell_seat {
|
struct ivi_shell_seat {
|
||||||
struct weston_seat *seat;
|
struct weston_seat *seat;
|
||||||
struct wl_listener seat_destroy_listener;
|
struct wl_listener seat_destroy_listener;
|
||||||
|
struct ivi_layout_surface *focused_ivisurf;
|
||||||
|
|
||||||
struct wl_list link; /** ivi_shell::seat_list */
|
struct wl_list link; /** ivi_shell::seat_list */
|
||||||
};
|
};
|
||||||
|
@ -135,6 +136,43 @@ shell_get_ivi_layout_surface(struct weston_surface *surface)
|
||||||
return shsurf->layout_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
|
void
|
||||||
shell_surface_send_configure(struct weston_surface *surface,
|
shell_surface_send_configure(struct weston_surface *surface,
|
||||||
int32_t width, int32_t height)
|
int32_t width, int32_t height)
|
||||||
|
@ -523,9 +561,8 @@ activate_binding(struct weston_seat *seat,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: need to activate the surface like
|
ivi_layout_surface_activate_with_seat(ivisurf->layout_surface, seat,
|
||||||
kiosk_shell_surface_activate() */
|
flags);
|
||||||
weston_view_activate_input(focus_view, seat, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -66,6 +66,13 @@ struct ivi_layout_surface;
|
||||||
struct ivi_layout_surface *
|
struct ivi_layout_surface *
|
||||||
shell_get_ivi_layout_surface(struct weston_surface *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
|
void
|
||||||
shell_ensure_text_input(struct ivi_shell *shell);
|
shell_ensure_text_input(struct ivi_shell *shell);
|
||||||
bool
|
bool
|
||||||
|
|
Loading…
Reference in a new issue