Index: uspace/srv/hid/input/layout/cz.c
===================================================================
--- uspace/srv/hid/input/layout/cz.c	(revision 5f8829315f6bebf5769560deb1bd34bc914628c4)
+++ uspace/srv/hid/input/layout/cz.c	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2009 Jiri Svoboda
+ * Copyright (c) 2011 Jiri Svoboda
  * All rights reserved.
  *
@@ -32,4 +32,5 @@
  */
 
+#include <errno.h>
 #include <kbd.h>
 #include <io/console.h>
@@ -37,7 +38,9 @@
 #include <bool.h>
 #include <layout.h>
-
-static void layout_reset(void);
-static wchar_t layout_parse_ev(kbd_event_t *ev);
+#include <stdlib.h>
+
+static int cz_create(layout_t *);
+static void cz_destroy(layout_t *);
+static wchar_t cz_parse_ev(layout_t *, kbd_event_t *ev);
 
 enum m_state {
@@ -47,9 +50,12 @@
 };
 
-static enum m_state mstate;
-
-layout_op_t cz_op = {
-	layout_reset,
-	layout_parse_ev
+typedef struct {
+	enum m_state mstate;
+} layout_cz_t;
+
+layout_ops_t cz_ops = {
+	.create = cz_create,
+	.destroy = cz_destroy,
+	.parse_ev = cz_parse_ev
 };
 
@@ -273,9 +279,9 @@
 }
 
-static wchar_t parse_ms_hacek(kbd_event_t *ev)
+static wchar_t parse_ms_hacek(layout_cz_t *cz_state, kbd_event_t *ev)
 {
 	wchar_t c;
 
-	mstate = ms_start;
+	cz_state->mstate = ms_start;
 
 	/* Produce no characters when Ctrl or Alt is pressed. */
@@ -291,9 +297,9 @@
 }
 
-static wchar_t parse_ms_carka(kbd_event_t *ev)
+static wchar_t parse_ms_carka(layout_cz_t *cz_state, kbd_event_t *ev)
 {
 	wchar_t c;
 
-	mstate = ms_start;
+	cz_state->mstate = ms_start;
 
 	/* Produce no characters when Ctrl or Alt is pressed. */
@@ -309,5 +315,5 @@
 }
 
-static wchar_t parse_ms_start(kbd_event_t *ev)
+static wchar_t parse_ms_start(layout_cz_t *cz_state, kbd_event_t *ev)
 {
 	wchar_t c;
@@ -319,7 +325,7 @@
 	if (ev->key == KC_EQUALS) {
 		if ((ev->mods & KM_SHIFT) != 0)
-			mstate = ms_hacek;
+			cz_state->mstate = ms_hacek;
 		else
-			mstate = ms_carka;
+			cz_state->mstate = ms_carka;
 
 		return 0;
@@ -379,11 +385,29 @@
 }
 
-static void layout_reset(void)
-{
-	mstate = ms_start;
-}
-
-static wchar_t layout_parse_ev(kbd_event_t *ev)
-{
+static int cz_create(layout_t *state)
+{
+	layout_cz_t *cz_state;
+
+	cz_state = malloc(sizeof(layout_cz_t));
+	if (cz_state == NULL) {
+		printf(NAME ": Out of memory.\n");
+		return ENOMEM;
+	}
+
+	cz_state->mstate = ms_start;
+	state->layout_priv = (void *) cz_state;
+
+	return EOK;
+}
+
+static void cz_destroy(layout_t *state)
+{
+	free(state->layout_priv);
+}
+
+static wchar_t cz_parse_ev(layout_t *state, kbd_event_t *ev)
+{
+	layout_cz_t *cz_state = (layout_cz_t *) state->layout_priv;
+
 	if (ev->type != KEY_PRESS)
 		return 0;
@@ -392,11 +416,11 @@
 		return 0;
 	
-	switch (mstate) {
+	switch (cz_state->mstate) {
 	case ms_start:
-		return parse_ms_start(ev);
+		return parse_ms_start(cz_state, ev);
 	case ms_hacek:
-		return parse_ms_hacek(ev);
+		return parse_ms_hacek(cz_state, ev);
 	case ms_carka:
-		return parse_ms_carka(ev);
+		return parse_ms_carka(cz_state, ev);
 	}
 	
Index: uspace/srv/hid/input/layout/us_dvorak.c
===================================================================
--- uspace/srv/hid/input/layout/us_dvorak.c	(revision 5f8829315f6bebf5769560deb1bd34bc914628c4)
+++ uspace/srv/hid/input/layout/us_dvorak.c	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2009 Jiri Svoboda
+ * Copyright (c) 2011 Jiri Svoboda
  * All rights reserved.
  *
@@ -32,4 +32,5 @@
  */
 
+#include <errno.h>
 #include <kbd.h>
 #include <io/console.h>
@@ -37,10 +38,12 @@
 #include <layout.h>
 
-static void layout_reset(void);
-static wchar_t layout_parse_ev(kbd_event_t *ev);
-
-layout_op_t us_dvorak_op = {
-	layout_reset,
-	layout_parse_ev
+static int us_dvorak_create(layout_t *);
+static void us_dvorak_destroy(layout_t *);
+static wchar_t us_dvorak_parse_ev(layout_t *, kbd_event_t *ev);
+
+layout_ops_t us_dvorak_ops = {
+	.create = us_dvorak_create,
+	.destroy = us_dvorak_destroy,
+	.parse_ev = us_dvorak_parse_ev
 };
 
@@ -206,9 +209,14 @@
 }
 
-static void layout_reset(void)
-{
-}
-
-static wchar_t layout_parse_ev(kbd_event_t *ev)
+static int us_dvorak_create(layout_t *state)
+{
+	return EOK;
+}
+
+static void us_dvorak_destroy(layout_t *state)
+{
+}
+
+static wchar_t us_dvorak_parse_ev(layout_t *state, kbd_event_t *ev)
 {
 	wchar_t c;
Index: uspace/srv/hid/input/layout/us_qwerty.c
===================================================================
--- uspace/srv/hid/input/layout/us_qwerty.c	(revision 5f8829315f6bebf5769560deb1bd34bc914628c4)
+++ uspace/srv/hid/input/layout/us_qwerty.c	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2009 Jiri Svoboda
+ * Copyright (c) 2011 Jiri Svoboda
  * All rights reserved.
  *
@@ -32,4 +32,5 @@
  */
 
+#include <errno.h>
 #include <kbd.h>
 #include <io/console.h>
@@ -37,10 +38,12 @@
 #include <layout.h>
 
-static void layout_reset(void);
-static wchar_t layout_parse_ev(kbd_event_t *ev);
-
-layout_op_t us_qwerty_op = {
-	layout_reset,
-	layout_parse_ev
+static int us_qwerty_create(layout_t *);
+static void us_qwerty_destroy(layout_t *);
+static wchar_t us_qwerty_parse_ev(layout_t *, kbd_event_t *ev);
+
+layout_ops_t us_qwerty_ops = {
+	.create = us_qwerty_create,
+	.destroy = us_qwerty_destroy,
+	.parse_ev = us_qwerty_parse_ev
 };
 
@@ -200,9 +203,14 @@
 }
 
-static void layout_reset(void)
-{
-}
-
-static wchar_t layout_parse_ev(kbd_event_t *ev)
+static int us_qwerty_create(layout_t *state)
+{
+	return EOK;
+}
+
+static void us_qwerty_destroy(layout_t *state)
+{
+}
+
+static wchar_t us_qwerty_parse_ev(layout_t *state, kbd_event_t *ev)
 {
 	wchar_t c;
