Index: uspace/lib/ui/src/window.c
===================================================================
--- uspace/lib/ui/src/window.c	(revision 1215db9d1ade6fae2cbc2685459e7ecd9b62efef)
+++ uspace/lib/ui/src/window.c	(revision 3c3657c839d290bbff8acf285476858b027d8657)
@@ -132,16 +132,19 @@
 /** Compute where window should be placed on the screen.
  *
- * This only applies to windows that do not use default placement.
- *
- * @param window Window
- * @param display Display
- * @param info Display info
+ * This only applies to windows that do not use default placement or
+ * if we are running in full-screen mode.
+ *
+ * @param window Window
+ * @param drect Display rectangle
  * @param params Window parameters
  * @param pos Place to store position of top-left corner
  */
-static void ui_window_place(ui_window_t *window, display_t *display,
-    display_info_t *info, ui_wnd_params_t *params, gfx_coord2_t *pos)
-{
-	assert(params->placement != ui_wnd_place_default);
+static void ui_window_place(ui_window_t *window, gfx_rect_t *drect,
+    ui_wnd_params_t *params, gfx_coord2_t *pos)
+{
+	gfx_coord2_t dims;
+
+	assert(params->placement != ui_wnd_place_default ||
+	    ui_is_fullscreen(window->ui));
 
 	pos->x = 0;
@@ -150,21 +153,26 @@
 	switch (params->placement) {
 	case ui_wnd_place_default:
-		assert(false);
+		assert(ui_is_fullscreen(window->ui));
+		/* Center window */
+		gfx_rect_dims(&params->rect, &dims);
+		pos->x = (drect->p0.x + drect->p1.x) / 2 - dims.x / 2;
+		pos->y = (drect->p0.y + drect->p1.y) / 2 - dims.y / 2;
+		break;
 	case ui_wnd_place_top_left:
 	case ui_wnd_place_full_screen:
-		pos->x = info->rect.p0.x - params->rect.p0.x;
-		pos->y = info->rect.p0.y - params->rect.p0.y;
+		pos->x = drect->p0.x - params->rect.p0.x;
+		pos->y = drect->p0.y - params->rect.p0.y;
 		break;
 	case ui_wnd_place_top_right:
-		pos->x = info->rect.p1.x - params->rect.p1.x;
-		pos->y = info->rect.p0.y - params->rect.p0.y;
+		pos->x = drect->p1.x - params->rect.p1.x;
+		pos->y = drect->p0.y - params->rect.p0.y;
 		break;
 	case ui_wnd_place_bottom_left:
-		pos->x = info->rect.p0.x - params->rect.p0.x;
-		pos->y = info->rect.p1.y - params->rect.p1.y;
+		pos->x = drect->p0.x - params->rect.p0.x;
+		pos->y = drect->p1.y - params->rect.p1.y;
 		break;
 	case ui_wnd_place_bottom_right:
-		pos->x = info->rect.p1.x - params->rect.p1.x;
-		pos->y = info->rect.p1.y - params->rect.p1.y;
+		pos->x = drect->p1.x - params->rect.p1.x;
+		pos->y = drect->p1.y - params->rect.p1.y;
 		break;
 	case ui_wnd_place_popup:
@@ -204,4 +212,6 @@
 		return ENOMEM;
 
+	window->ui = ui;
+
 	display_wnd_params_init(&dparams);
 	dparams.rect = params->rect;
@@ -228,6 +238,6 @@
 		if (params->placement != ui_wnd_place_default) {
 			/* Set initial display window position */
-			ui_window_place(window, ui->display, &info,
-			    params, &dparams.pos);
+			ui_window_place(window, &info.rect, params,
+			    &dparams.pos);
 
 			dparams.flags |= wndf_setpos;
@@ -293,4 +303,6 @@
 	window->gc = gc;
 #endif
+	if (ui->display == NULL)
+		ui_window_place(window, &ui->rect, params, &window->dpos);
 
 	rc = ui_resource_create(window->gc, ui_is_textmode(ui), &res);
@@ -308,7 +320,5 @@
 	ui_resource_set_expose_cb(res, ui_window_expose_cb, (void *) window);
 
-	window->ui = ui;
 	window->rect = dparams.rect;
-
 	window->res = res;
 	window->wdecor = wdecor;
@@ -594,6 +604,5 @@
 			return rc;
 	} else {
-		pos->x = 0;
-		pos->y = 0;
+		*pos = window->dpos;
 	}
 
@@ -1014,6 +1023,8 @@
 	ui_window_t *window = (ui_window_t *) arg;
 
-	if (!gfx_rect_is_empty(&window->dirty_rect))
-		(void) gfx_bitmap_render(window->bmp, &window->dirty_rect, NULL);
+	if (!gfx_rect_is_empty(&window->dirty_rect)) {
+		(void) gfx_bitmap_render(window->bmp, &window->dirty_rect,
+		    &window->dpos);
+	}
 
 	window->dirty_rect.p0.x = 0;
@@ -1031,6 +1042,14 @@
 {
 	ui_window_t *window = (ui_window_t *) arg;
-
-	return gfx_cursor_get_pos(window->realgc, pos);
+	gfx_coord2_t cpos;
+	errno_t rc;
+
+	rc = gfx_cursor_get_pos(window->realgc, &cpos);
+	if (rc != EOK)
+		return rc;
+
+	pos->x = cpos.x - window->dpos.x;
+	pos->y = cpos.y - window->dpos.y;
+	return EOK;
 }
 
@@ -1043,6 +1062,10 @@
 {
 	ui_window_t *window = (ui_window_t *) arg;
-
-	return gfx_cursor_set_pos(window->realgc, pos);
+	gfx_coord2_t cpos;
+
+	cpos.x = pos->x + window->dpos.x;
+	cpos.y = pos->y + window->dpos.y;
+
+	return gfx_cursor_set_pos(window->realgc, &cpos);
 }
 
