Index: src/gtkhtml.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
retrieving revision 1.515
diff -u -r1.515 gtkhtml.c
--- src/gtkhtml.c	11 Jun 2003 17:34:02 -0000	1.515
+++ src/gtkhtml.c	13 Jun 2003 01:32:01 -0000
@@ -1477,7 +1477,7 @@
 					    || HTML_IS_LINK_TEXT (obj)))
 					html_engine_set_focus_object (orig_e, obj);
 				else
-					html_engine_set_focus_object (orig_e, NULL);
+					html_engine_jump_at (engine, x, y);
 			}
 			if (html->allow_selection) {
 				if (event->state & GDK_SHIFT_MASK)
@@ -3786,8 +3786,9 @@
 {
 	gint amount;
 
-	if (!html_engine_get_editable (html->engine))
+	/* if (!html_engine_get_editable (html->engine))
 		return;
+	*/
 
 	if (html->engine->selection_mode) {
 		if (!html->engine->mark)
Index: src/htmlengine-edit-cursor.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine-edit-cursor.c,v
retrieving revision 1.22
diff -u -r1.22 htmlengine-edit-cursor.c
--- src/htmlengine-edit-cursor.c	2 Apr 2003 05:41:47 -0000	1.22
+++ src/htmlengine-edit-cursor.c	13 Jun 2003 01:32:02 -0000
@@ -29,6 +29,7 @@
 #include "htmlengine-edit-table.h"
 #include "htmlengine-edit-tablecell.h"
 #include "htmlimage.h"
+#include "htmliframe.h"
 #include "htmlobject.h"
 #include "htmltable.h"
 
@@ -47,14 +48,41 @@
 static GdkColor image_stipple_active_on      = { 0, 0xffff, 0,      0 };
 static GdkColor image_stipple_active_off     = { 0, 0xffff, 0xffff, 0xffff };
 
+static HTMLEngine *
+get_direct_engine(HTMLObject * obj)
+{
+        HTMLObject * parent;
+	int i = 0;
+                                                                                
+        parent = obj;
+        while (parent) {
+                if ((HTML_OBJECT_TYPE (parent) == HTML_TYPE_FRAME)
+                    || (HTML_OBJECT_TYPE (parent) == HTML_TYPE_IFRAME)) {
+                       return html_object_get_engine (parent, NULL);
+                }
+                parent = parent->parent;
+        }
+                                                                                
+        return NULL;
+}
+
 void
 html_engine_hide_cursor  (HTMLEngine *engine)
 {
+	HTMLEngine *e = engine;
+
 	g_return_if_fail (engine != NULL);
 	g_return_if_fail (HTML_IS_ENGINE (engine));
 
-	if (engine->editable && engine->cursor_hide_count == 0)
-		html_engine_draw_cursor_in_area (engine, 0, 0, -1, -1);
+	if (engine->cursor_hide_count == 0) {
+		if (!engine->editable) {
+        		e = get_direct_engine(engine->cursor->object);
+			if (e)
+				html_cursor_copy(e->cursor, engine->cursor);
+			else 	e = engine;
+		}
+		html_engine_draw_cursor_in_area (e, 0, 0, -1, -1);
+	}
 
 	engine->cursor_hide_count++;
 }
@@ -62,22 +90,36 @@
 void
 html_engine_show_cursor  (HTMLEngine *engine)
 {
+        HTMLEngine * e = engine;
+
 	g_return_if_fail (engine != NULL);
 	g_return_if_fail (HTML_IS_ENGINE (engine));
+	g_return_if_fail (engine->cursor != NULL);
 
 	if (engine->cursor_hide_count > 0) {
 		engine->cursor_hide_count--;
-		if (engine->editable && engine->cursor_hide_count == 0)
-			html_engine_draw_cursor_in_area (engine, 0, 0, -1, -1);
+		if (engine->cursor_hide_count == 0) {
+			if (!engine->editable) {
+        			e = get_direct_engine(engine->cursor->object);
+				if (e) 
+				  html_cursor_copy(e->cursor, engine->cursor);
+				else e = engine;
+			}
+			html_engine_draw_cursor_in_area (e, 0, 0, -1, -1);
+		}
 	}
 }
 
 static gboolean
 clip_rect (HTMLEngine *engine, gint x, gint y, gint width, gint height, gint *x1, gint *y1, gint *x2, gint *y2)
 {
-	if (*x1 >= x + width || *y1 >= y + height || *x2 < x || *y2 < y)
+	if (*x1 > x + width || *y1 > y + height || *x2 < x || *y2 < y)
 		return FALSE;
 
+	if (*x1 == x + width)
+		*x1 = x + width - 1;
+	if (*y1 == y + width)
+		*y1 = y + height - 1;
 	if (*x2 >= x + width)
 		*x2 = x + width - 1;
 	if (*y2 >= y + height)
@@ -265,15 +307,13 @@
 	gint x1, y1, x2, y2;
 	GdkRectangle pos;
 
-	g_assert (engine->editable);
-
-	if (engine->editable && (engine->cursor_hide_count <= 0 && !engine->thaw_idle_id)) {
+	if ((engine->cursor_hide_count <= 0 && !engine->thaw_idle_id)) {
 		html_engine_draw_table_cursor (engine);
 		html_engine_draw_cell_cursor (engine);
 		html_engine_draw_image_cursor (engine);
 	}
 
-	if (!cursor_enabled || engine->cursor_hide_count > 0 || ! engine->editable || engine->thaw_idle_id)
+	if (!cursor_enabled || engine->cursor_hide_count > 0 || engine->thaw_idle_id)
 		return;
 
 	obj = engine->cursor->object;
@@ -289,15 +329,24 @@
 		y = 0;
 	}
 
-	
 	html_object_get_cursor (obj, engine->painter, offset, &x1, &y1, &x2, &y2);
-	
 	pos.x = x1; 
 	pos.y = y1;
 	pos.width = x2 - x1;
 	pos.height = x2 - x1;
 	gtk_im_context_set_cursor_location (GTK_HTML (engine->widget)->priv->im_context, &pos);
 
+	obj = g_object_get_data(G_OBJECT(gtk_widget_get_parent(GTK_WIDGET(engine->widget))), "embeddedelement");	
+	if (obj) {
+		HTMLEmbedded * element;
+
+		element = HTML_EMBEDDED(obj);
+		x1 -= element->abs_x;
+		x2 -= element->abs_x;
+		y1 -= element->abs_y;
+		y2 -= element->abs_y;
+	}
+
 	if (clip_rect (engine, x, y, width, height, &x1, &y1, &x2, &y2)) {
 		gdk_draw_line (engine->window, engine->invert_gc, x1, y1, x2, y2);
 	}
@@ -309,7 +358,7 @@
 static gint
 blink_timeout_cb (gpointer data)
 {
-	HTMLEngine *engine;
+	HTMLEngine *engine, *e;
 
 	g_return_val_if_fail (HTML_IS_ENGINE (data), FALSE);
 
Index: src/htmlengine-edit-movement.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine-edit-movement.c,v
retrieving revision 1.15
diff -u -r1.15 htmlengine-edit-movement.c
--- src/htmlengine-edit-movement.c	25 Apr 2001 21:31:53 -0000	1.15
+++ src/htmlengine-edit-movement.c	13 Jun 2003 01:32:03 -0000
@@ -275,8 +275,10 @@
 		if (new_y == y)
 			break;
 
-		if (new_y < start_y)
+		if (new_y < start_y) {
+			html_engine_show_cursor (engine);
 			return 0;
+		}
 
 		if (new_y - start_y >= amount) {
 			html_cursor_copy (cursor, &prev_cursor);
Index: src/htmlengine.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine.c,v
retrieving revision 1.543
diff -u -r1.543 htmlengine.c
--- src/htmlengine.c	11 Jun 2003 17:34:02 -0000	1.543
+++ src/htmlengine.c	13 Jun 2003 01:32:16 -0000
@@ -3936,13 +3936,13 @@
 
 	e->updateTimer = 0;
 
-	if (html_engine_get_editable (e))
-		html_engine_hide_cursor (e);
+	html_engine_hide_cursor (e);
 	html_engine_calc_size (e, FALSE);
 
 	if (GTK_LAYOUT (e->widget)->vadjustment == NULL
 	    || ! html_gdk_painter_realized (HTML_GDK_PAINTER (e->painter))) {
 		e->need_update = TRUE;
+		html_engine_show_cursor (e);
 		return FALSE;
 	}
 
@@ -3981,8 +3981,7 @@
 	gtk_container_forall (GTK_CONTAINER (e->widget), update_embedded, e->widget);
 	html_engine_queue_redraw_all (e);
 
-	if (html_engine_get_editable (e))
-		html_engine_show_cursor (e);
+	html_engine_show_cursor (e);
 	
 	return FALSE;
 }
@@ -4585,13 +4584,10 @@
 		html_engine_ensure_editable (e);
 		html_cursor_home (e->cursor, e);
 		e->newPage = FALSE;
+	} 
 
-		if (e->have_focus)
-			html_engine_setup_blinking_cursor (e);
-	} else {
-		if (e->have_focus)
-			html_engine_stop_blinking_cursor (e);
-	}
+	if (e->have_focus)
+		html_engine_setup_blinking_cursor (e);
 }
 
 gboolean
@@ -4622,12 +4618,10 @@
 	g_return_if_fail (engine != NULL);
 	g_return_if_fail (HTML_IS_ENGINE (engine));
 
-	if (engine->editable) {
-		if (! engine->have_focus && have_focus)
-			html_engine_setup_blinking_cursor (engine);
-		else if (engine->have_focus && ! have_focus)
-			html_engine_stop_blinking_cursor (engine);
-	}
+	if (! engine->have_focus && have_focus)
+		html_engine_setup_blinking_cursor (engine);
+	else if (engine->have_focus && ! have_focus)
+		html_engine_stop_blinking_cursor (engine);
 
 	engine->have_focus = have_focus;
 
@@ -4662,8 +4656,10 @@
 
 	g_return_val_if_fail (e != NULL, FALSE);
 
+	/*
 	if (! e->editable)
 		return FALSE;
+	*/
 
 	if (e->cursor->object == NULL)
 		return FALSE;
Index: src/htmliframe.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmliframe.c,v
retrieving revision 1.74
diff -u -r1.74 htmliframe.c
--- src/htmliframe.c	19 May 2003 13:12:04 -0000	1.74
+++ src/htmliframe.c	13 Jun 2003 01:32:18 -0000
@@ -592,6 +592,8 @@
 
 	new_widget = gtk_html_new ();
 	new_html = GTK_HTML (new_widget);
+	/* Hacking, make it show cursor. */
+	new_html->engine->cursor_hide_count = 0;
 
 	new_tokenizer = html_tokenizer_clone (parent_html->engine->ht);
 
