[add simple keyboard layout row
timo.lindfors@iki.fi**20080822082050] {
hunk ./main.c 11
+GtkWidget *label;
hunk ./main.c 13
-void hello(GtkWidget *widget, gpointer data) {
+char *get_key_for_coord(int x, int y) {
+    if (y > 150 && y < 250) {
+	if (x > 40 && x < 600) {
+	    int xr;
+
+	    xr = x % 56;
+	    if (xr < 45) {
+		char *p;
+		p = malloc(2);
+		p[0] = "qwertyuiop"[(x-40)/56];
+		p[1] = 0;
+		return p;
+	    }
+	}
+    }
+    return "";
+}
+
+void label_clicked(GtkWidget *widget, gpointer data) {
hunk ./main.c 34
-    g_print("Hello World\n");
+    g_print("label clicked\n");
hunk ./main.c 39
-    //
+    assert(ret == 1);
hunk ./main.c 42
-
hunk ./main.c 54
-void motion(GtkWidget *widget, GdkEventMotion *e) {
+void motion_notify(GtkWidget *widget, GdkEventMotion *e) {
hunk ./main.c 59
-		    e->x_root - 50,
+		    e->x_root - 5,
hunk ./main.c 61
+    {
+	char *p;
+	char buf[256];
+	p = get_key_for_coord(e->x_root,
+			      e->y_root);
+	sprintf(buf, "<span font_desc=\"Times 72\">%s</span>", p);
+	
+	gtk_label_set_markup(label,
+			     buf);
+    }
hunk ./main.c 87
-	GtkWidget *button;
-	
hunk ./main.c 91
-	g_signal_connect(G_OBJECT(window), "delete_event",
+	g_signal_connect(G_OBJECT(window),
+			 "delete_event",
hunk ./main.c 95
-	g_signal_connect(G_OBJECT(window), "destroy",
+	g_signal_connect(G_OBJECT(window),
+			 "destroy",
hunk ./main.c 101
-			 G_CALLBACK(motion),
+			 G_CALLBACK(motion_notify),
hunk ./main.c 114
-	button = gtk_button_new_with_label("Hello World");
-	g_signal_connect(G_OBJECT(button), "clicked",
-			 G_CALLBACK(hello), NULL);
+	label = gtk_label_new("xx");
+	//g_signal_connect(G_OBJECT(label),
+	//"clicked",
+	//G_CALLBACK(label_clicked),
+	//NULL);
hunk ./main.c 120
-	gtk_container_add(GTK_CONTAINER(window), button);
+	gtk_container_add(GTK_CONTAINER(window), label);
hunk ./main.c 122
-	gtk_widget_show(button);
+	gtk_widget_show(label);
hunk ./main.c 143
-// grab mouse
}
