shell: Set initial toplevel position in map callback
diff --git a/compositor/shell.c b/compositor/shell.c
index e012482..c44ebca 100644
--- a/compositor/shell.c
+++ b/compositor/shell.c
@@ -263,17 +263,10 @@
{
struct wlsc_surface *es = surface_resource->data;
- struct wlsc_compositor *ec = es->compositor;
if (es->map_type == WLSC_SURFACE_MAP_FULLSCREEN) {
es->x = es->saved_x;
es->y = es->saved_y;
- } else if (es->map_type == WLSC_SURFACE_MAP_UNMAPPED) {
- es->x = 10 + random() % 400;
- es->y = 10 + random() % 400;
- /* assign to first output */
- es->output = container_of(ec->output_list.next,
- struct wlsc_output, link);
}
wlsc_surface_damage(es);
@@ -934,6 +927,11 @@
else
wl_list_insert(&shell->panel->link, &surface->link);
+ if (surface->map_type == WLSC_SURFACE_MAP_TOPLEVEL) {
+ surface->x = 10 + random() % 400;
+ surface->y = 10 + random() % 400;
+ }
+
wlsc_surface_configure(surface, surface->x, surface->y, width, height);
}