Index: uspace/lib/display/src/display.c
===================================================================
--- uspace/lib/display/src/display.c	(revision f5191b449e0b356b9d44b1a2339ee32df02f1200)
+++ uspace/lib/display/src/display.c	(revision 4645b2c34ead210c775e6151cfd474eff304e55a)
@@ -295,5 +295,5 @@
 			break;
 
-		if (window->cb->kbd_event != NULL)
+		if (window->cb != NULL && window->cb->kbd_event != NULL)
 			window->cb->kbd_event(window->cb_arg, &event.kbd_event);
 	}
Index: uspace/lib/gui/meson.build
===================================================================
--- uspace/lib/gui/meson.build	(revision f5191b449e0b356b9d44b1a2339ee32df02f1200)
+++ uspace/lib/gui/meson.build	(revision 4645b2c34ead210c775e6151cfd474eff304e55a)
@@ -27,5 +27,5 @@
 #
 
-deps = [ 'draw' , 'softrend' , 'graph' ]
+deps = [ 'draw' , 'softrend', 'display' ]
 src = files(
 	'common.c',
Index: uspace/lib/gui/window.c
===================================================================
--- uspace/lib/gui/window.c	(revision f5191b449e0b356b9d44b1a2339ee32df02f1200)
+++ uspace/lib/gui/window.c	(revision 4645b2c34ead210c775e6151cfd474eff304e55a)
@@ -48,5 +48,4 @@
 #include <adt/list.h>
 
-#include <async.h>
 #include <loc.h>
 
@@ -56,4 +55,5 @@
 #include <draw/drawctx.h>
 #include <draw/surface.h>
+#include <display.h>
 
 #include "common.h"
@@ -283,5 +283,5 @@
 			flags |= btn_left ? GF_RESIZE_X : GF_SCALE_X;
 			flags |= btn_left ? GF_RESIZE_Y : GF_SCALE_Y;
-			win_grab(widget->window->osess, event.pos_id, flags);
+			//win_grab(widget->window->osess, event.pos_id, flags);
 		} else if (bottom && left && allowed_button) {
 			window_grab_flags_t flags = GF_EMPTY;
@@ -289,10 +289,10 @@
 			flags |= btn_left ? GF_RESIZE_X : GF_SCALE_X;
 			flags |= btn_left ? GF_RESIZE_Y : GF_SCALE_Y;
-			win_grab(widget->window->osess, event.pos_id, flags);
+			//win_grab(widget->window->osess, event.pos_id, flags);
 		} else if (bottom && right && allowed_button) {
 			window_grab_flags_t flags = GF_EMPTY;
 			flags |= btn_left ? GF_RESIZE_X : GF_SCALE_X;
 			flags |= btn_left ? GF_RESIZE_Y : GF_SCALE_Y;
-			win_grab(widget->window->osess, event.pos_id, flags);
+			//win_grab(widget->window->osess, event.pos_id, flags);
 		} else if (top && right && allowed_button) {
 			window_grab_flags_t flags = GF_EMPTY;
@@ -300,30 +300,30 @@
 			flags |= btn_left ? GF_RESIZE_X : GF_SCALE_X;
 			flags |= btn_left ? GF_RESIZE_Y : GF_SCALE_Y;
-			win_grab(widget->window->osess, event.pos_id, flags);
+			//win_grab(widget->window->osess, event.pos_id, flags);
 		} else if (top && allowed_button) {
 			window_grab_flags_t flags = GF_EMPTY;
 			flags |= GF_MOVE_Y;
 			flags |= btn_left ? GF_RESIZE_Y : GF_SCALE_Y;
-			win_grab(widget->window->osess, event.pos_id, flags);
+			//win_grab(widget->window->osess, event.pos_id, flags);
 		} else if (left && allowed_button) {
 			window_grab_flags_t flags = GF_EMPTY;
 			flags |= GF_MOVE_X;
 			flags |= btn_left ? GF_RESIZE_X : GF_SCALE_X;
-			win_grab(widget->window->osess, event.pos_id, flags);
+			//win_grab(widget->window->osess, event.pos_id, flags);
 		} else if (bottom && allowed_button) {
 			window_grab_flags_t flags = GF_EMPTY;
 			flags |= btn_left ? GF_RESIZE_Y : GF_SCALE_Y;
-			win_grab(widget->window->osess, event.pos_id, flags);
+			//win_grab(widget->window->osess, event.pos_id, flags);
 		} else if (right && allowed_button) {
 			window_grab_flags_t flags = GF_EMPTY;
 			flags |= btn_left ? GF_RESIZE_X : GF_SCALE_X;
-			win_grab(widget->window->osess, event.pos_id, flags);
+			//win_grab(widget->window->osess, event.pos_id, flags);
 		} else if (close && btn_left) {
-			win_close_request(widget->window->osess);
+			//win_close_request(widget->window->osess);
 		} else if (header && btn_left) {
 			window_grab_flags_t flags = GF_EMPTY;
 			flags |= GF_MOVE_X;
 			flags |= GF_MOVE_Y;
-			win_grab(widget->window->osess, event.pos_id, flags);
+			//win_grab(widget->window->osess, event.pos_id, flags);
 		} else {
 			list_foreach(widget->children, link, widget_t, child) {
@@ -370,11 +370,14 @@
     sysarg_t width, sysarg_t height, window_placement_flags_t placement_flags)
 {
+	gfx_bitmap_params_t params;
+	gfx_bitmap_alloc_t alloc;
+
 	if (width < 2 * border_thickness + header_min_width) {
-		win_damage(win->osess, 0, 0, 0, 0);
+		//win_damage(win->osess, 0, 0, 0, 0);
 		return;
 	}
 
 	if (height < 2 * border_thickness + header_height) {
-		win_damage(win->osess, 0, 0, 0, 0);
+		//win_damage(win->osess, 0, 0, 0, 0);
 		return;
 	}
@@ -386,8 +389,27 @@
 		return;
 
+	gfx_bitmap_t *new_bitmap = NULL;
+
+	params.rect.p0.x = 0;
+	params.rect.p0.y = 0;
+	params.rect.p1.x = width;
+	params.rect.p1.y = height;
+
+	alloc.pitch = width * sizeof(uint32_t);
+	alloc.off0 = 0;
+	alloc.pixels = surface_direct_access(new_surface);
+
+	errno_t rc = gfx_bitmap_create(win->gc, &params, &alloc, &new_bitmap);
+	if (rc != EOK) {
+		surface_destroy(new_surface);
+		return;
+	}
+
 	/* Switch new and old surface. */
 	fibril_mutex_lock(&win->guard);
 	surface_t *old_surface = win->surface;
+	gfx_bitmap_t *old_bitmap = win->bitmap;
 	win->surface = new_surface;
+	win->bitmap = new_bitmap;
 	fibril_mutex_unlock(&win->guard);
 
@@ -403,6 +425,7 @@
 
 	/* Inform compositor about new surface. */
-	errno_t rc = win_resize(win->osess, offset_x, offset_y, width, height,
-	    placement_flags, surface_direct_access(new_surface));
+//	errno_t rc = win_resize(win->osess, offset_x, offset_y, width, height,
+//	    placement_flags, surface_direct_access(new_surface));
+	rc = EOK;
 
 	if (rc != EOK) {
@@ -429,7 +452,11 @@
 		surface_destroy(new_surface);
 	} else {
+		if (old_bitmap != NULL)
+			gfx_bitmap_destroy(old_bitmap);
 		/* Deallocate old surface. */
 		if (old_surface)
 			surface_destroy(old_surface);
+
+		(void) gfx_bitmap_render(win->bitmap, NULL, NULL);
 	}
 }
@@ -443,4 +470,5 @@
 {
 	sysarg_t x, y, width, height;
+	gfx_rect_t rect;
 	fibril_mutex_lock(&win->guard);
 	surface_get_damaged_region(win->surface, &x, &y, &width, &height);
@@ -448,7 +476,17 @@
 	fibril_mutex_unlock(&win->guard);
 
+
 	if (width > 0 && height > 0) {
 		/* Notify compositor. */
-		win_damage(win->osess, x, y, width, height);
+		//win_damage(win->osess, x, y, width, height);
+
+		rect.p0.x = x;
+		rect.p0.y = y;
+		rect.p1.x = x + width;
+		rect.p1.y = y + height;
+
+		printf("render damaged region: %d,%d,%d,%d,\n",
+		    (int)x,(int)y,(int)width,(int)height);
+		(void) gfx_bitmap_render(win->bitmap, &rect, NULL);
 	}
 }
@@ -472,7 +510,6 @@
 	win->focus = NULL;
 
-	win_close(win->osess);
-	async_hangup(win->isess);
-	async_hangup(win->osess);
+	display_window_destroy(win->dwindow);
+	display_close(win->display);
 
 	while (!list_empty(&win->events.list)) {
@@ -562,9 +599,9 @@
 static errno_t fetch_input(void *arg)
 {
-	errno_t rc;
-	bool terminate = false;
-	window_t *win = (window_t *) arg;
-
-	while (true) {
+//	errno_t rc;
+//	bool terminate = false;
+//	window_t *win = (window_t *) arg;
+
+/*	while (true) {
 		window_event_t *event = (window_event_t *) malloc(sizeof(window_event_t));
 
@@ -587,5 +624,5 @@
 		}
 	}
-
+*/
 	return 0;
 }
@@ -616,6 +653,5 @@
 	win->surface = NULL;
 
-	service_id_t reg_dsid;
-	errno_t rc = loc_service_get_id(winreg, &reg_dsid, 0);
+	errno_t rc = display_open(winreg, &win->display);
 	if (rc != EOK) {
 		free(win);
@@ -623,29 +659,24 @@
 	}
 
-	async_sess_t *reg_sess =
-	    loc_service_connect(reg_dsid, INTERFACE_COMPOSITOR, 0);
-	if (reg_sess == NULL) {
+	display_wnd_params_t params;
+	display_wnd_params_init(&params);
+
+	params.rect.p0.x = 0;
+	params.rect.p0.y = 0;
+	params.rect.p1.x = 200;
+	params.rect.p1.y = 100;
+
+	rc = display_window_create(win->display, &params, NULL, NULL,
+	    &win->dwindow);
+	if (rc != EOK) {
+		display_close(win->display);
 		free(win);
 		return NULL;
 	}
 
-	service_id_t in_dsid;
-	service_id_t out_dsid;
-	rc = win_register(reg_sess, flags, &in_dsid, &out_dsid);
-	async_hangup(reg_sess);
+	rc = display_window_get_gc(win->dwindow, &win->gc);
 	if (rc != EOK) {
-		free(win);
-		return NULL;
-	}
-
-	win->osess = loc_service_connect(out_dsid, INTERFACE_COMPOSITOR, 0);
-	if (win->osess == NULL) {
-		free(win);
-		return NULL;
-	}
-
-	win->isess = loc_service_connect(in_dsid, INTERFACE_COMPOSITOR, 0);
-	if (win->isess == NULL) {
-		async_hangup(win->osess);
+		(void) display_window_destroy(win->dwindow);
+		display_close(win->display);
 		free(win);
 		return NULL;
@@ -746,5 +777,5 @@
 {
 	/* Request compositor to init closing cascade. */
-	win_close_request(win->osess);
+	//win_close_request(win->osess);
 }
 
Index: uspace/lib/gui/window.h
===================================================================
--- uspace/lib/gui/window.h	(revision f5191b449e0b356b9d44b1a2339ee32df02f1200)
+++ uspace/lib/gui/window.h	(revision 4645b2c34ead210c775e6151cfd474eff304e55a)
@@ -37,5 +37,4 @@
 #define GUI_WINDOW_H_
 
-#include <async.h>
 #include <adt/prodcons.h>
 #include <fibril_synch.h>
@@ -43,4 +42,7 @@
 #include <io/window.h>
 #include <draw/surface.h>
+#include <display.h>
+#include <gfx/bitmap.h>
+#include <gfx/context.h>
 
 #include "widget.h"
@@ -51,6 +53,7 @@
 	bool is_focused; /**< True for the top level window of the desktop. */
 	char *caption; /**< Text title of the window header. */
-	async_sess_t *isess; /**< Input events from compositor. */
-	async_sess_t *osess; /**< Mainly for damage reporting to compositor. */
+	display_t *display; /**< Display service */
+	display_window_t *dwindow; /**< Display window */
+	gfx_context_t *gc; /**< GC of the window */
 	prodcons_t events; /**< Queue for window event loop. */
 	widget_t root; /**< Decoration widget serving as a root of widget hiearchy. */
@@ -59,4 +62,5 @@
 	fibril_mutex_t guard; /**< Mutex guarding window surface. */
 	surface_t *surface; /**< Window surface shared with compositor. */
+	gfx_bitmap_t *bitmap; /**< Window bitmap */
 };
 
Index: uspace/lib/meson.build
===================================================================
--- uspace/lib/meson.build	(revision f5191b449e0b356b9d44b1a2339ee32df02f1200)
+++ uspace/lib/meson.build	(revision 4645b2c34ead210c775e6151cfd474eff304e55a)
@@ -76,9 +76,10 @@
 
 	'bithenge',
+	'congfx',
 	'draw',
 	'drv',
 	'ext4',
-	'gui',
 	'hound',
+	'ipcgfx',
 	'nic',
 	'usb',
@@ -89,11 +90,11 @@
 	'virtio',
 
-	'congfx',
-	'guigfx',
 	'ieee80211',
-	'ipcgfx',
-
 	'ddev',
 	'display',
+
+	'gui',
+
+	'guigfx',
 ]
 
