Author: rjek
Date: Mon Aug 14 23:41:38 2006
New Revision: 2846
URL:
http://svn.semichrome.net?rev=2846&view=rev
Log:
Fix setting focus on drawing area and caret plotting in new nsgtk
Modified:
branches/rjek/glade/gtk/gtk_window.c
branches/rjek/glade/gtk/netsurf.glade
Modified: branches/rjek/glade/gtk/gtk_window.c
URL:
http://svn.semichrome.net/branches/rjek/glade/gtk/gtk_window.c?rev=2846&a...
==============================================================================
--- branches/rjek/glade/gtk/gtk_window.c (original)
+++ branches/rjek/glade/gtk/gtk_window.c Mon Aug 14 23:41:38 2006
@@ -102,6 +102,7 @@
static void nsgtk_perform_deferred_resize(void *);
static void nsgtk_window_update_back_forward(struct gui_window *);
static void nsgtk_throb(void *);
+static void nsgtk_redraw_caret(struct gui_window *);
static gboolean nsgtk_window_back_button_clicked(GtkWidget *, gpointer);
static gboolean nsgtk_window_forward_button_clicked(GtkWidget *, gpointer);
@@ -417,6 +418,15 @@
schedule(10, nsgtk_throb, p);
}
+void nsgtk_redraw_caret(struct gui_window *g)
+{
+ if (g->careth == 0)
+ return;
+
+ gui_window_redraw(g, g->caretx, g->carety,
+ g->caretx, g->carety + g->careth);
+}
+
/* signal handling functions for the toolbar and URL bar */
gboolean nsgtk_window_back_button_clicked(GtkWidget *widget, gpointer data)
{
@@ -656,6 +666,8 @@
g->scale = clone->window->scale;
else
g->scale = 1.0;
+
+ g->careth = 0;
/* load the window template from the glade xml file, and extract
* widget references from it for later use.
@@ -996,12 +1008,24 @@
void gui_window_place_caret(struct gui_window *g, int x, int y, int height)
{
-
+ nsgtk_redraw_caret(g);
+
+ g->caretx = x;
+ g->carety = y + 1;
+ g->careth = height;
+
+ nsgtk_redraw_caret(g);
+
+ gtk_widget_grab_focus(g->drawing_area);
}
void gui_window_remove_caret(struct gui_window *g)
{
-
+ if (g->careth == 0)
+ return;
+
+ gui_window_redraw(g, g->caretx, g->carety,
+ g->caretx, g->carety + g->careth);
}
void gui_window_new_content(struct gui_window *g)
Modified: branches/rjek/glade/gtk/netsurf.glade
URL:
http://svn.semichrome.net/branches/rjek/glade/gtk/netsurf.glade?rev=2846&...
==============================================================================
--- branches/rjek/glade/gtk/netsurf.glade (original)
+++ branches/rjek/glade/gtk/netsurf.glade Mon Aug 14 23:41:38 2006
@@ -4228,6 +4228,8 @@
<child>
<widget class="GtkDrawingArea" id="drawingArea">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
</widget>
</child>
</widget>