Index: uspace/lib/c/generic/io/chargrid.c
===================================================================
--- uspace/lib/c/generic/io/chargrid.c	(revision 20dccf3f4f41fb6f49fd3071c60e29e100cdae1d)
+++ uspace/lib/c/generic/io/chargrid.c	(revision 20dccf3f4f41fb6f49fd3071c60e29e100cdae1d)
@@ -0,0 +1,358 @@
+/*
+ * Copyright (c) 2006 Josef Cejka
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#include <io/style.h>
+#include <malloc.h>
+#include <unistd.h>
+#include <assert.h>
+#include <bool.h>
+#include <as.h>
+#include <io/chargrid.h>
+
+/** Create a chargrid.
+ *
+ * @param[in] cols  Number of columns.
+ * @param[in] rows  Number of rows.
+ * @param[in] flags Chargrid flags.
+ *
+ * @return New chargrid.
+ * @return NULL on failure.
+ *
+ */
+chargrid_t *chargrid_create(sysarg_t cols, sysarg_t rows,
+    chargrid_flag_t flags)
+{
+	size_t size =
+	    sizeof(chargrid_t) + cols * rows * sizeof(charfield_t);
+	chargrid_t *scrbuf;
+	
+	if ((flags & CHARGRID_FLAG_SHARED) == CHARGRID_FLAG_SHARED) {
+		scrbuf = (chargrid_t *) as_area_create(AS_AREA_ANY, size,
+		    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
+		if (scrbuf == AS_MAP_FAILED)
+			return NULL;
+	} else {
+		scrbuf = (chargrid_t *) malloc(size);
+		if (scrbuf == NULL)
+			return NULL;
+	}
+	
+	scrbuf->size = size;
+	scrbuf->flags = flags;
+	scrbuf->cols = cols;
+	scrbuf->rows = rows;
+	scrbuf->cursor_visible = false;
+	
+	scrbuf->attrs.type = CHAR_ATTR_STYLE;
+	scrbuf->attrs.val.style = STYLE_NORMAL;
+	
+	scrbuf->top_row = 0;
+	chargrid_clear(scrbuf);
+	
+	return scrbuf;
+}
+
+void chargrid_destroy(chargrid_t *srcbuf)
+{
+	// TODO
+}
+
+bool chargrid_cursor_at(chargrid_t *scrbuf, sysarg_t col, sysarg_t row)
+{
+	return ((scrbuf->cursor_visible) && (scrbuf->col == col) &&
+	    (scrbuf->row == row));
+}
+
+sysarg_t chargrid_get_top_row(chargrid_t *scrbuf)
+{
+	return scrbuf->top_row;
+}
+
+static sysarg_t chargrid_update_rows(chargrid_t *scrbuf)
+{
+	if (scrbuf->row == scrbuf->rows) {
+		scrbuf->row = scrbuf->rows - 1;
+		scrbuf->top_row = (scrbuf->top_row + 1) % scrbuf->rows;
+		chargrid_clear_row(scrbuf, scrbuf->row);
+		
+		return scrbuf->rows;
+	}
+	
+	return 2;
+}
+
+static sysarg_t chargrid_update_cols(chargrid_t *scrbuf)
+{
+	/* Column overflow */
+	if (scrbuf->col == scrbuf->cols) {
+		scrbuf->col = 0;
+		scrbuf->row++;
+		return chargrid_update_rows(scrbuf);
+	}
+	
+	return 1;
+}
+
+/** Store one character to chargrid.
+ *
+ * Its position is determined by scrbuf->col
+ * and scrbuf->row.
+ *
+ * @param scrbuf Chargrid.
+ * @param ch     Character to store.
+ * @param update Update coordinates.
+ *
+ * @return Number of rows which have been affected. In usual
+ *         situations this is 1. If the current position was
+ *         updated to a new row, this value is 2.
+ *
+ */
+sysarg_t chargrid_putchar(chargrid_t *scrbuf, wchar_t ch, bool update)
+{
+	assert(scrbuf->col < scrbuf->cols);
+	assert(scrbuf->row < scrbuf->rows);
+	
+	charfield_t *field =
+	    chargrid_charfield_at(scrbuf, scrbuf->col, scrbuf->row);
+	
+	field->ch = ch;
+	field->attrs = scrbuf->attrs;
+	field->flags |= CHAR_FLAG_DIRTY;
+	
+	if (update) {
+		scrbuf->col++;
+		return chargrid_update_cols(scrbuf);
+	}
+	
+	return 1;
+}
+
+/** Jump to a new row in chargrid.
+ *
+ * @param scrbuf Chargrid.
+ *
+ * @return Number of rows which have been affected. In usual
+ *         situations this is 2 (the original row and the new
+ *         row).
+ *
+ */
+sysarg_t chargrid_newline(chargrid_t *scrbuf)
+{
+	assert(scrbuf->col < scrbuf->cols);
+	assert(scrbuf->row < scrbuf->rows);
+	
+	scrbuf->col = 0;
+	scrbuf->row++;
+	
+	return chargrid_update_rows(scrbuf);
+}
+
+/** Jump to a new row in chargrid.
+ *
+ * @param scrbuf   Chargrid.
+ * @param tab_size Tab size.
+ *
+ * @return Number of rows which have been affected. In usual
+ *         situations this is 1. If the current position was
+ *         updated to a new row, this value is 2.
+ *
+ */
+sysarg_t chargrid_tabstop(chargrid_t *scrbuf, sysarg_t tab_size)
+{
+	assert(scrbuf->col < scrbuf->cols);
+	assert(scrbuf->row < scrbuf->rows);
+	
+	sysarg_t spaces = tab_size - scrbuf->cols % tab_size;
+	sysarg_t flush = 1;
+	
+	for (sysarg_t i = 0; i < spaces; i++)
+		flush += chargrid_putchar(scrbuf, ' ', true) - 1;
+	
+	return flush;
+}
+
+/** Jump to the previous character in chargrid.
+ *
+ * Currently no scrollback is supported.
+ *
+ * @param scrbuf Chargrid.
+ *
+ * @return Number of rows which have been affected. In usual
+ *         situations this is 1. If the current position was
+ *         updated to the previous row, this value is 2.
+ * @return 0 if no backspace is possible.
+ *
+ */
+sysarg_t chargrid_backspace(chargrid_t *scrbuf)
+{
+	assert(scrbuf->col < scrbuf->cols);
+	assert(scrbuf->row < scrbuf->rows);
+	
+	if ((scrbuf->col == 0) && (scrbuf->row == 0))
+		return 0;
+	
+	if (scrbuf->col == 0) {
+		scrbuf->col = scrbuf->cols - 1;
+		scrbuf->row--;
+		
+		chargrid_putchar(scrbuf, ' ', false);
+		return 2;
+	}
+	
+	scrbuf->col--;
+	chargrid_putchar(scrbuf, ' ', false);
+	return 1;
+}
+
+/** Clear the chargrid.
+ *
+ * @param scrbuf Chargrid.
+ *
+ */
+void chargrid_clear(chargrid_t *scrbuf)
+{
+	for (size_t pos = 0; pos < (scrbuf->cols * scrbuf->rows); pos++) {
+		scrbuf->data[pos].ch = 0;
+		scrbuf->data[pos].attrs = scrbuf->attrs;
+		scrbuf->data[pos].flags = CHAR_FLAG_DIRTY;
+	}
+	
+	scrbuf->col = 0;
+	scrbuf->row = 0;
+}
+
+/** Update current chargrid coordinates
+ *
+ * @param scrbuf Chargrid.
+ * @param col    New column.
+ * @param row    New row.
+ *
+ */
+void chargrid_set_cursor(chargrid_t *scrbuf, sysarg_t col, sysarg_t row)
+{
+	scrbuf->col = col;
+	scrbuf->row = row;
+}
+
+void chargrid_set_cursor_visibility(chargrid_t *scrbuf, bool visible)
+{
+	scrbuf->cursor_visible = visible;
+}
+
+/** Get current chargrid coordinates
+ *
+ * @param scrbuf Chargrid.
+ * @param col    Column.
+ * @param row    Row.
+ *
+ */
+void chargrid_get_cursor(chargrid_t *scrbuf, sysarg_t *col,
+    sysarg_t *row)
+{
+	assert(col);
+	assert(row);
+	
+	*col = scrbuf->col;
+	*row = scrbuf->row;
+}
+
+bool chargrid_get_cursor_visibility(chargrid_t *scrbuf)
+{
+	return scrbuf->cursor_visible;
+}
+
+/** Clear one buffer row.
+ *
+ * @param scrbuf Chargrid.
+ * @param row    Row to clear.
+ *
+ */
+void chargrid_clear_row(chargrid_t *scrbuf, sysarg_t row)
+{
+	for (sysarg_t col = 0; col < scrbuf->cols; col++) {
+		charfield_t *field =
+		    chargrid_charfield_at(scrbuf, col, row);
+		
+		field->ch = 0;
+		field->attrs = scrbuf->attrs;
+		field->flags |= CHAR_FLAG_DIRTY;
+	}
+}
+
+/** Set chargrid style.
+ *
+ * @param scrbuf Chargrid.
+ * @param style  Style.
+ *
+ */
+void chargrid_set_style(chargrid_t *scrbuf, console_style_t style)
+{
+	scrbuf->attrs.type = CHAR_ATTR_STYLE;
+	scrbuf->attrs.val.style = style;
+}
+
+/** Set chargrid color.
+ *
+ * @param scrbuf  Chargrid.
+ * @param bgcolor Background color.
+ * @param fgcolor Foreground color.
+ * @param attr    Color attribute.
+ *
+ */
+void chargrid_set_color(chargrid_t *scrbuf, console_color_t bgcolor,
+    console_color_t fgcolor, console_color_attr_t attr)
+{
+	scrbuf->attrs.type = CHAR_ATTR_INDEX;
+	scrbuf->attrs.val.index.bgcolor = bgcolor;
+	scrbuf->attrs.val.index.fgcolor = fgcolor;
+	scrbuf->attrs.val.index.attr = attr;
+}
+
+/** Set chargrid RGB color.
+ *
+ * @param scrbuf  Chargrid.
+ * @param bgcolor Background color.
+ * @param fgcolor Foreground color.
+ *
+ */
+void chargrid_set_rgb_color(chargrid_t *scrbuf, pixel_t bgcolor,
+    pixel_t fgcolor)
+{
+	scrbuf->attrs.type = CHAR_ATTR_RGB;
+	scrbuf->attrs.val.rgb.bgcolor = bgcolor;
+	scrbuf->attrs.val.rgb.fgcolor = fgcolor;
+}
+
+/** @}
+ */
Index: uspace/lib/c/generic/io/output.c
===================================================================
--- uspace/lib/c/generic/io/output.c	(revision 20dccf3f4f41fb6f49fd3071c60e29e100cdae1d)
+++ uspace/lib/c/generic/io/output.c	(revision 20dccf3f4f41fb6f49fd3071c60e29e100cdae1d)
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2011 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#include <async.h>
+#include <errno.h>
+#include <as.h>
+#include <ipc/output.h>
+#include <io/output.h>
+
+int output_yield(async_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_0_0(exch, OUTPUT_YIELD);
+	async_exchange_end(exch);
+	
+	return ret;
+}
+
+int output_claim(async_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_0_0(exch, OUTPUT_CLAIM);
+	async_exchange_end(exch);
+	
+	return ret;
+}
+
+int output_get_dimensions(async_sess_t *sess, sysarg_t *maxx, sysarg_t *maxy)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_0_2(exch, OUTPUT_GET_DIMENSIONS, maxx, maxy);
+	async_exchange_end(exch);
+	
+	return ret;
+}
+
+int output_get_caps(async_sess_t *sess, console_caps_t *ccaps)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	
+	sysarg_t rv;
+	int ret = async_req_0_1(exch, OUTPUT_GET_CAPS, &rv);
+	
+	async_exchange_end(exch);
+	
+	if (ret == EOK)
+		*ccaps = (console_caps_t) rv;
+	
+	return ret;
+}
+
+frontbuf_handle_t output_frontbuf_create(async_sess_t *sess,
+    chargrid_t *frontbuf)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	
+	ipc_call_t answer;
+	aid_t req = async_send_0(exch, OUTPUT_FRONTBUF_CREATE, &answer);
+	int rc = async_share_out_start(exch, frontbuf, AS_AREA_READ
+	    | AS_AREA_WRITE | AS_AREA_CACHEABLE);
+	
+	async_exchange_end(exch);
+	
+	sysarg_t ret;
+	async_wait_for(req, &ret);
+	
+	if ((rc != EOK) || (ret != EOK))
+		return 0;
+	
+	return (frontbuf_handle_t) IPC_GET_ARG1(answer);
+}
+
+int output_set_style(async_sess_t *sess, console_style_t style)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_1_0(exch, OUTPUT_SET_STYLE, style);
+	async_exchange_end(exch);
+	
+	return ret;
+}
+
+int output_cursor_update(async_sess_t *sess, frontbuf_handle_t frontbuf)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_1_0(exch, OUTPUT_CURSOR_UPDATE, frontbuf);
+	async_exchange_end(exch);
+	
+	return ret;
+}
+
+int output_update(async_sess_t *sess, frontbuf_handle_t frontbuf)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_1_0(exch, OUTPUT_UPDATE, frontbuf);
+	async_exchange_end(exch);
+	
+	return ret;
+}
+
+int output_damage(async_sess_t *sess, frontbuf_handle_t frontbuf, sysarg_t col,
+    sysarg_t row, sysarg_t cols, sysarg_t rows)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_5_0(exch, OUTPUT_DAMAGE, frontbuf, col, row,
+	    cols, rows);
+	async_exchange_end(exch);
+	
+	return ret;
+}
+
+/** @}
+ */
Index: uspace/lib/c/generic/io/visualizer.c
===================================================================
--- uspace/lib/c/generic/io/visualizer.c	(revision 20dccf3f4f41fb6f49fd3071c60e29e100cdae1d)
+++ uspace/lib/c/generic/io/visualizer.c	(revision 20dccf3f4f41fb6f49fd3071c60e29e100cdae1d)
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#include <errno.h>
+#include <as.h>
+#include <ipc/graph.h>
+#include <io/visualizer.h>
+
+int visualizer_claim(async_sess_t *sess, sysarg_t notif_callback_id)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_1_0(exch, VISUALIZER_CLAIM, notif_callback_id);
+	async_exchange_end(exch);
+
+	return ret;
+}
+
+int visualizer_yield(async_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_0_0(exch, VISUALIZER_YIELD);
+	async_exchange_end(exch);
+
+	return ret;
+}
+
+int visualizer_enumerate_modes(async_sess_t *sess, vslmode_t *mode, sysarg_t nth)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_1(exch, VISUALIZER_ENUMERATE_MODES, nth, &answer);
+
+	int rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
+
+	async_exchange_end(exch);
+
+	sysarg_t ret;
+	async_wait_for(req, &ret);
+
+	if (rc != EOK) {
+		return rc;
+	} else if (ret != EOK) {
+		return ret;
+	} else {
+		return EOK;
+	}
+}
+
+int visualizer_get_default_mode(async_sess_t *sess, vslmode_t *mode)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_0(exch, VISUALIZER_GET_DEFAULT_MODE, &answer);
+
+	int rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
+
+	async_exchange_end(exch);
+
+	sysarg_t ret;
+	async_wait_for(req, &ret);
+
+	if (rc != EOK) {
+		return rc;
+	} else if (ret != EOK) {
+		return ret;
+	} else {
+		return EOK;
+	}
+}
+
+int visualizer_get_current_mode(async_sess_t *sess, vslmode_t *mode)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_0(exch, VISUALIZER_GET_CURRENT_MODE, &answer);
+
+	int rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
+
+	async_exchange_end(exch);
+
+	sysarg_t ret;
+	async_wait_for(req, &ret);
+
+	if (rc != EOK) {
+		return rc;
+	} else if (ret != EOK) {
+		return ret;
+	} else {
+		return EOK;
+	}
+}
+
+int visualizer_get_mode(async_sess_t *sess, vslmode_t *mode, sysarg_t index)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_1(exch, VISUALIZER_GET_MODE, index, &answer);
+
+	int rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
+
+	async_exchange_end(exch);
+
+	sysarg_t ret;
+	async_wait_for(req, &ret);
+
+	if (rc != EOK) {
+		return rc;
+	} else if (ret != EOK) {
+		return ret;
+	} else {
+		return EOK;
+	}
+}
+
+int visualizer_set_mode(async_sess_t *sess, sysarg_t index, sysarg_t version, void *cells)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_2(exch, VISUALIZER_SET_MODE, index, version, &answer);
+
+	int rc = async_share_out_start(exch, cells, AS_AREA_READ | AS_AREA_CACHEABLE);
+
+	async_exchange_end(exch);
+
+	sysarg_t ret;
+	async_wait_for(req, &ret);
+
+	if (rc != EOK) {
+		return rc;
+	} else if (ret != EOK) {
+		return ret;
+	} else {
+		return EOK;
+	}
+}
+
+int visualizer_update_damaged_region(async_sess_t *sess,
+    sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height,
+	sysarg_t x_offset, sysarg_t y_offset)
+{
+#ifdef __32_BITS__
+	sysarg_t offsets = ((x_offset << 16) | (y_offset & 0x0000ffff));
+#else
+	sysarg_t offsets = ((x_offset << 32) | (y_offset & 0xffffffff));
+#endif
+
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_5_0(exch, VISUALIZER_UPDATE_DAMAGED_REGION,
+	    x, y, width, height, offsets);
+	async_exchange_end(exch);
+
+	return ret;
+}
+
+int visualizer_suspend(async_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_0_0(exch, VISUALIZER_SUSPEND);
+	async_exchange_end(exch);
+
+	return ret;
+}
+
+int visualizer_wakeup(async_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_0_0(exch, VISUALIZER_WAKE_UP);
+	async_exchange_end(exch);
+
+	return ret;
+}
+
+/** @}
+ */
Index: uspace/lib/c/generic/io/window.c
===================================================================
--- uspace/lib/c/generic/io/window.c	(revision 20dccf3f4f41fb6f49fd3071c60e29e100cdae1d)
+++ uspace/lib/c/generic/io/window.c	(revision 20dccf3f4f41fb6f49fd3071c60e29e100cdae1d)
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2012 Petr Koupy
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#include <errno.h>
+#include <as.h>
+#include <ipc/window.h>
+#include <io/window.h>
+
+#include <stdio.h>
+
+int win_register(async_sess_t *sess, service_id_t *in, service_id_t *out)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_0_2(exch, WINDOW_REGISTER, in, out);
+	async_exchange_end(exch);
+
+	return ret;
+}
+
+int win_get_event(async_sess_t *sess, window_event_t *event)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_0(exch, WINDOW_GET_EVENT, &answer);
+
+	int rc = async_data_read_start(exch, event, sizeof(window_event_t));
+
+	async_exchange_end(exch);
+
+	sysarg_t ret;
+	async_wait_for(req, &ret);
+
+	if (rc != EOK) {
+		return rc;
+	} else if (ret != EOK) {
+		return ret;
+	} else {
+		return EOK;
+	}
+}
+
+int win_damage(async_sess_t *sess,
+    sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_4_0(exch, WINDOW_DAMAGE, x, y, width, height);
+	async_exchange_end(exch);
+
+	return ret;
+}
+
+int win_grab(async_sess_t *sess, sysarg_t pos_id, sysarg_t grab_flags)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_2_0(exch, WINDOW_GRAB, pos_id, grab_flags);
+	async_exchange_end(exch);
+
+	return ret;
+}
+
+int win_resize(async_sess_t *sess, sysarg_t width, sysarg_t height, void *cells)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_2(exch, WINDOW_RESIZE, width, height, &answer);
+
+	int rc = async_share_out_start(exch, cells, AS_AREA_READ | AS_AREA_CACHEABLE);
+
+	async_exchange_end(exch);
+
+	sysarg_t ret;
+	async_wait_for(req, &ret);
+
+	if (rc != EOK) {
+		return rc;
+	} else if (ret != EOK) {
+		return ret;
+	} else {
+		return EOK;
+	}
+}
+
+int win_close(async_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_0_0(exch, WINDOW_CLOSE);
+	async_exchange_end(exch);
+
+	return ret;
+}
+
+int win_close_request(async_sess_t *sess)
+{
+	async_exch_t *exch = async_exchange_begin(sess);
+	int ret = async_req_0_0(exch, WINDOW_CLOSE_REQUEST);
+	async_exchange_end(exch);
+
+	return ret;
+}
+
+/** @}
+ */
