Index: uspace/srv/hid/display/test/seat.c
===================================================================
--- uspace/srv/hid/display/test/seat.c	(revision 34342334f4ef070d93f0cc4c5270e49e76ef9e7e)
+++ uspace/srv/hid/display/test/seat.c	(revision 946a6664e1498063d4e0b88a4020e290191684b2)
@@ -134,3 +134,199 @@
 }
 
+/** Test ds_seat_post_kbd_event() with Alt-Tab switches focus */
+PCUT_TEST(post_kbd_event_alt_tab)
+{
+	ds_display_t *disp;
+	ds_client_t *client;
+	ds_seat_t *seat;
+	ds_window_t *w0;
+	ds_window_t *w1;
+	display_wnd_params_t params;
+	kbd_event_t event;
+	errno_t rc;
+
+	rc = ds_display_create(NULL, &disp);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ds_seat_create(disp, &seat);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	display_wnd_params_init(&params);
+	params.rect.p0.x = params.rect.p0.y = 0;
+	params.rect.p1.x = params.rect.p1.y = 1;
+
+	rc = ds_window_create(client, &params, &w1);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ds_window_create(client, &params, &w0);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	ds_seat_set_focus(seat, w1);
+	PCUT_ASSERT_EQUALS(w1, seat->focus);
+
+	event.type = KEY_PRESS;
+	event.mods = KM_ALT;
+	event.key = KC_TAB;
+	rc = ds_seat_post_kbd_event(seat, &event);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_EQUALS(w0, seat->focus);
+
+	ds_window_destroy(w0);
+	ds_window_destroy(w1);
+	ds_seat_destroy(seat);
+	ds_client_destroy(client);
+	ds_display_destroy(disp);
+}
+
+/** Test ds_seat_post_kbd_event() with regular key press delivers to client queue */
+PCUT_TEST(post_kbd_event_regular)
+{
+	ds_display_t *disp;
+	ds_client_t *client;
+	ds_seat_t *seat;
+	ds_window_t *wnd;
+	display_wnd_params_t params;
+	kbd_event_t event;
+	ds_window_t *rwindow;
+	display_wnd_ev_t revent;
+	bool called_cb = NULL;
+	errno_t rc;
+
+	rc = ds_display_create(NULL, &disp);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ds_seat_create(disp, &seat);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	display_wnd_params_init(&params);
+	params.rect.p0.x = params.rect.p0.y = 0;
+	params.rect.p1.x = params.rect.p1.y = 1;
+
+	rc = ds_window_create(client, &params, &wnd);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	ds_seat_set_focus(seat, wnd);
+	PCUT_ASSERT_EQUALS(wnd, seat->focus);
+
+	event.type = KEY_PRESS;
+	event.key = KC_ENTER;
+	event.mods = 0;
+	event.c = L'\0';
+
+	PCUT_ASSERT_FALSE(called_cb);
+
+	rc = ds_client_get_event(client, &rwindow, &revent);
+	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
+
+	rc = ds_seat_post_kbd_event(seat, &event);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_TRUE(called_cb);
+
+	rc = ds_client_get_event(client, &rwindow, &revent);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_EQUALS(wnd, rwindow);
+	PCUT_ASSERT_EQUALS(event.type, revent.kbd_event.type);
+	PCUT_ASSERT_EQUALS(event.key, revent.kbd_event.key);
+	PCUT_ASSERT_EQUALS(event.mods, revent.kbd_event.mods);
+	PCUT_ASSERT_EQUALS(event.c, revent.kbd_event.c);
+
+	rc = ds_client_get_event(client, &rwindow, &revent);
+	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
+
+	ds_window_destroy(wnd);
+	ds_client_destroy(client);
+	ds_display_destroy(disp);
+}
+
+/** Test ds_seat_post_ptd_event() with click on window switches focus
+ */
+PCUT_TEST(post_ptd_event_wnd_switch)
+{
+	ds_display_t *disp;
+	ds_seat_t *seat;
+	ds_client_t *client;
+	ds_window_t *w0, *w1;
+	display_wnd_params_t params;
+	ptd_event_t event;
+	bool called_cb = false;
+	errno_t rc;
+
+	rc = ds_display_create(NULL, &disp);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ds_seat_create(disp, &seat);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	display_wnd_params_init(&params);
+	params.rect.p0.x = params.rect.p0.y = 0;
+	params.rect.p1.x = params.rect.p1.y = 1;
+
+	rc = ds_window_create(client, &params, &w0);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ds_window_create(client, &params, &w1);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	w0->dpos.x = 10;
+	w0->dpos.y = 10;
+
+	w1->dpos.x = 400;
+	w1->dpos.y = 400;
+
+	PCUT_ASSERT_FALSE(called_cb);
+
+	ds_seat_set_focus(seat, w0);
+
+	event.type = PTD_MOVE;
+	event.dmove.x = 400;
+	event.dmove.y = 400;
+	rc = ds_seat_post_ptd_event(seat, &event);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_FALSE(called_cb);
+
+	event.type = PTD_PRESS;
+	event.btn_num = 1;
+	rc = ds_seat_post_ptd_event(seat, &event);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_FALSE(called_cb);
+
+	PCUT_ASSERT_EQUALS(w1, seat->focus);
+
+	event.type = PTD_MOVE;
+	event.dmove.x = -400 + 10;
+	event.dmove.y = -400 + 10;
+	rc = ds_seat_post_ptd_event(seat, &event);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_FALSE(called_cb);
+
+	event.type = PTD_PRESS;
+	event.btn_num = 1;
+	rc = ds_seat_post_ptd_event(seat, &event);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_FALSE(called_cb);
+
+	PCUT_ASSERT_EQUALS(w0, seat->focus);
+
+	ds_window_destroy(w0);
+	ds_window_destroy(w1);
+	ds_client_destroy(client);
+	ds_seat_destroy(seat);
+	ds_display_destroy(disp);
+}
+
+/** Test ds_seat_post_pos_event() */
+PCUT_TEST(post_pos_event)
+{
+	// XXX
+}
+
 PCUT_EXPORT(seat);
