Commit 73325530 authored by myfreeweb's avatar myfreeweb

desktop-shell: activate xdg child surface on activation

This makes sure that when you navigate to a window with a transient
dialog open (like the GTK "About" dialog), the dialog will be activated.
parent 7788ec36
Pipeline #14775 failed with stage
in 1 minute and 48 seconds
......@@ -142,6 +142,8 @@ struct shell_surface {
int focus_count;
bool destroying;
struct shell_surface *parent, *child;
};
struct shell_grab {
......@@ -678,7 +680,7 @@ focus_state_surface_destroy(struct wl_listener *listener, void *data)
}
state->keyboard_focus = NULL;
activate(state->shell, next, state->seat,
WESTON_ACTIVATE_FLAG_CONFIGURE);
WESTON_ACTIVATE_FLAG_CONFIGURE | WESTON_ACTIVATE_FLAG_SKIP_CHILDREN);
} else {
if (state->shell->focus_animation_type == ANIMATION_DIM_LAYER) {
if (state->ws->focus_animation)
......@@ -2376,6 +2378,8 @@ desktop_surface_added(struct weston_desktop_surface *desktop_surface,
shsurf->desktop_surface = desktop_surface;
shsurf->view = view;
shsurf->fullscreen.black_view = NULL;
shsurf->parent = NULL;
shsurf->child = NULL;
wl_list_init(&shsurf->fullscreen.transform.link);
shell_surface_set_output(
......@@ -2411,6 +2415,11 @@ desktop_surface_removed(struct weston_desktop_surface *desktop_surface,
if (shsurf->fullscreen.black_view)
weston_surface_destroy(shsurf->fullscreen.black_view->surface);
if (shsurf->parent)
shsurf->parent->child = NULL;
if (shsurf->child)
shsurf->child->parent = NULL;
weston_surface_set_label_func(surface, NULL);
weston_desktop_surface_set_user_data(shsurf->desktop_surface, NULL);
shsurf->desktop_surface = NULL;
......@@ -2621,6 +2630,24 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
}
}
void
desktop_surface_set_parent(struct weston_desktop_surface *desktop_surface,
struct weston_desktop_surface *parent_desktop_surface,
void *user_data)
{
struct shell_surface *shsurf, *parent_shsurf;
if (!desktop_surface || !parent_desktop_surface) {
return;
}
shsurf = weston_desktop_surface_get_user_data(desktop_surface);
parent_shsurf = weston_desktop_surface_get_user_data(parent_desktop_surface);
shsurf->parent = parent_shsurf;
parent_shsurf->child = shsurf;
}
static void
get_maximized_size(struct shell_surface *shsurf, int32_t *width, int32_t *height)
{
......@@ -2900,6 +2927,7 @@ static const struct weston_desktop_api shell_desktop_api = {
.surface_added = desktop_surface_added,
.surface_removed = desktop_surface_removed,
.committed = desktop_surface_committed,
.set_parent = desktop_surface_set_parent,
.move = desktop_surface_move,
.resize = desktop_surface_resize,
.fullscreen_requested = desktop_surface_fullscreen_requested,
......@@ -3790,6 +3818,11 @@ activate(struct desktop_shell *shell, struct weston_view *view,
ws = get_current_workspace(shell);
animate_focus_change(shell, ws, get_default_view(old_es), get_default_view(es));
}
if (shsurf->child && !(flags & WESTON_ACTIVATE_FLAG_SKIP_CHILDREN)) {
activate(shell, shsurf->child->view, seat, flags);
return;
}
}
/* no-op func for checking black surface */
......
......@@ -1533,6 +1533,7 @@ enum weston_activate_flag {
WESTON_ACTIVATE_FLAG_NONE = 0,
WESTON_ACTIVATE_FLAG_CONFIGURE = 1 << 0,
WESTON_ACTIVATE_FLAG_CLICKED = 1 << 1,
WESTON_ACTIVATE_FLAG_SKIP_CHILDREN = 1 << 2,
};
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment