Index: uspace/lib/ui/test/window.c
===================================================================
--- uspace/lib/ui/test/window.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ uspace/lib/ui/test/window.c	(revision db3895d936f17c9389f3e8e2689bf28645fc3697)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2020 Jiri Svoboda
+ * Copyright (c) 2021 Jiri Svoboda
  * All rights reserved.
  *
@@ -66,8 +66,10 @@
 static errno_t test_ctl_paint(void *);
 static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *);
+static void test_ctl_unfocus(void *);
 
 static ui_control_ops_t test_ctl_ops = {
 	.paint = test_ctl_paint,
-	.pos_event = test_ctl_pos_event
+	.pos_event = test_ctl_pos_event,
+	.unfocus = test_ctl_unfocus
 };
 
@@ -90,4 +92,5 @@
 	bool pos;
 	pos_event_t pos_event;
+	bool unfocus;
 } test_ctl_resp_t;
 
@@ -175,4 +178,50 @@
 }
 
+/** ui_window_get_active */
+PCUT_TEST(get_active)
+{
+	errno_t rc;
+	ui_t *ui = NULL;
+	ui_wnd_params_t params;
+	ui_window_t *window1 = NULL;
+	ui_window_t *window2 = NULL;
+	ui_window_t *awnd;
+
+	rc = ui_create_cons(NULL, &ui);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	awnd = ui_window_get_active(ui);
+	PCUT_ASSERT_NULL(awnd);
+
+	ui_wnd_params_init(&params);
+	params.caption = "Hello";
+
+	rc = ui_window_create(ui, &params, &window1);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(window1);
+
+	awnd = ui_window_get_active(ui);
+	PCUT_ASSERT_EQUALS(window1, awnd);
+
+	rc = ui_window_create(ui, &params, &window2);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(window2);
+
+	awnd = ui_window_get_active(ui);
+	PCUT_ASSERT_EQUALS(window2, awnd);
+
+	ui_window_destroy(window2);
+
+	awnd = ui_window_get_active(ui);
+	PCUT_ASSERT_EQUALS(window1, awnd);
+
+	ui_window_destroy(window1);
+
+	awnd = ui_window_get_active(ui);
+	PCUT_ASSERT_NULL(awnd);
+
+	ui_destroy(ui);
+}
+
 /** ui_window_resize */
 PCUT_TEST(resize)
@@ -242,4 +291,28 @@
 }
 
+/** ui_window_set_ctl_cursor() */
+PCUT_TEST(set_ctl_cursor)
+{
+	errno_t rc;
+	ui_t *ui = NULL;
+	ui_wnd_params_t params;
+	ui_window_t *window = NULL;
+
+	rc = ui_create_disp(NULL, &ui);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	ui_wnd_params_init(&params);
+	params.caption = "Hello";
+
+	rc = ui_window_create(ui, &params, &window);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(window);
+
+	ui_window_set_ctl_cursor(window, ui_curs_ibeam);
+
+	ui_window_destroy(window);
+	ui_destroy(ui);
+}
+
 /** ui_window_get_app_gc() return valid GC */
 PCUT_TEST(get_app_gc)
@@ -258,6 +331,6 @@
 	params.rect.p0.x = 0;
 	params.rect.p0.y = 0;
-	params.rect.p0.x = 10;
-	params.rect.p0.y = 10;
+	params.rect.p0.x = 100;
+	params.rect.p0.y = 100;
 
 	rc = ui_window_create(ui, &params, &window);
@@ -388,4 +461,40 @@
 	PCUT_ASSERT_INT_EQUALS(event.hpos, resp.pos_event.hpos);
 	PCUT_ASSERT_INT_EQUALS(event.vpos, resp.pos_event.vpos);
+
+	/* Need to remove first because we didn't implement the destructor */
+	ui_window_remove(window, control);
+
+	ui_window_destroy(window);
+	ui_destroy(ui);
+}
+
+/** ui_window_def_unfocus() delivers unfocus event to control in window */
+PCUT_TEST(def_unfocus)
+{
+	errno_t rc;
+	ui_t *ui = NULL;
+	ui_wnd_params_t params;
+	ui_window_t *window = NULL;
+	ui_control_t *control = NULL;
+	test_ctl_resp_t resp;
+
+	rc = ui_create_disp(NULL, &ui);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	ui_wnd_params_init(&params);
+	params.caption = "Hello";
+
+	rc = ui_window_create(ui, &params, &window);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ui_control_new(&test_ctl_ops, &resp, &control);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	ui_window_add(window, control);
+
+	resp.unfocus = false;
+
+	ui_window_def_unfocus(window);
+	PCUT_ASSERT_TRUE(resp.unfocus);
 
 	/* Need to remove first because we didn't implement the destructor */
@@ -701,3 +810,10 @@
 }
 
+static void test_ctl_unfocus(void *arg)
+{
+	test_ctl_resp_t *resp = (test_ctl_resp_t *) arg;
+
+	resp->unfocus = true;
+}
+
 PCUT_EXPORT(window);
