shell: Take a wl_surface as parent for transient and popup windows

Kristian Høgsberg 13 years ago
parent 0636ac307e
commit 8150b190d6
  1. 4
      clients/window.c
  2. 2
      src/compositor.h
  3. 18
      src/shell.c
  4. 2
      src/xwayland/window-manager.c

@ -3009,7 +3009,7 @@ window_create_transient(struct display *display, struct window *parent,
if (display->shell)
wl_shell_surface_set_transient(window->shell_surface,
window->parent->shell_surface,
window->parent->surface,
window->x, window->y, flags);
return window;
@ -3155,7 +3155,7 @@ window_show_menu(struct display *display,
input_ungrab(input);
wl_shell_surface_set_popup(window->shell_surface, input->seat,
display_get_serial(window->display),
window->parent->shell_surface,
window->parent->surface,
window->x, window->y, 0);
widget_set_redraw_handler(menu->widget, menu_redraw_handler);

@ -82,7 +82,7 @@ struct weston_shell_interface {
void (*set_toplevel)(struct shell_surface *shsurf);
void (*set_transient)(struct shell_surface *shsurf,
struct shell_surface *pshsurf,
struct weston_surface *parent,
int x, int y, uint32_t flags);
int (*move)(struct shell_surface *shsurf, struct weston_seat *ws);
int (*resize)(struct shell_surface *shsurf,

@ -145,7 +145,7 @@ struct shell_surface {
struct weston_surface *surface;
struct wl_listener surface_destroy_listener;
struct shell_surface *parent;
struct weston_surface *parent;
struct desktop_shell *shell;
enum shell_surface_type type, next_type;
@ -1233,8 +1233,7 @@ static void
set_surface_type(struct shell_surface *shsurf)
{
struct weston_surface *surface = shsurf->surface;
struct shell_surface *pshsurf = shsurf->parent;
struct weston_surface *pes;
struct weston_surface *pes = shsurf->parent;
reset_shell_surface_type(shsurf);
@ -1245,7 +1244,6 @@ set_surface_type(struct shell_surface *shsurf)
case SHELL_SURFACE_TOPLEVEL:
break;
case SHELL_SURFACE_TRANSIENT:
pes = pshsurf->surface;
weston_surface_set_position(surface,
pes->geometry.x + shsurf->transient.x,
pes->geometry.y + shsurf->transient.y);
@ -1292,10 +1290,10 @@ shell_surface_set_toplevel(struct wl_client *client,
static void
set_transient(struct shell_surface *shsurf,
struct shell_surface *pshsurf, int x, int y, uint32_t flags)
struct weston_surface *parent, int x, int y, uint32_t flags)
{
/* assign to parents output */
shsurf->parent = pshsurf;
shsurf->parent = parent;
shsurf->transient.x = x;
shsurf->transient.y = y;
shsurf->transient.flags = flags;
@ -1309,9 +1307,9 @@ shell_surface_set_transient(struct wl_client *client,
int x, int y, uint32_t flags)
{
struct shell_surface *shsurf = resource->data;
struct shell_surface *pshsurf = parent_resource->data;
struct weston_surface *parent = parent_resource->data;
set_transient(shsurf, pshsurf, x, y, flags);
set_transient(shsurf, parent, x, y, flags);
}
static struct desktop_shell *
@ -1584,7 +1582,7 @@ shell_map_popup(struct shell_surface *shsurf)
{
struct wl_seat *seat = shsurf->popup.seat;
struct weston_surface *es = shsurf->surface;
struct weston_surface *parent = shsurf->parent->surface;
struct weston_surface *parent = shsurf->parent;
es->output = parent->output;
shsurf->popup.grab.interface = &popup_grab_interface;
@ -2572,7 +2570,7 @@ map(struct desktop_shell *shell, struct weston_surface *surface,
switch (surface_type) {
case SHELL_SURFACE_POPUP:
case SHELL_SURFACE_TRANSIENT:
parent = shsurf->parent->surface;
parent = shsurf->parent;
wl_list_insert(parent->layer_link.prev, &surface->layer_link);
break;
case SHELL_SURFACE_FULLSCREEN:

@ -1329,7 +1329,7 @@ xserver_map_shell_surface(struct weston_wm *wm,
}
parent = hash_table_lookup(wm->window_hash, window->transient_for->id);
shell_interface->set_transient(window->shsurf, parent->shsurf,
shell_interface->set_transient(window->shsurf, parent->surface,
window->x - parent->x + t->margin + t->width,
window->y - parent->y + t->margin + t->titlebar_height,
WL_SHELL_SURFACE_TRANSIENT_INACTIVE);

Loading…
Cancel
Save