--- ./src/msgwindow.c.orig	2011-05-01 17:59:21.000000000 +0300
+++ ./src/msgwindow.c	2011-08-10 11:32:11.000000000 +0300
@@ -124,18 +124,20 @@
 
 static gboolean on_msgwin_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
 {
-	if (ui_is_keyval_enter_or_return(event->keyval) || event->keyval == GDK_space)
+	gboolean enter_or_return = ui_is_keyval_enter_or_return(event->keyval);
+
+	if (enter_or_return || event->keyval == GDK_space)
 	{
 		switch (GPOINTER_TO_INT(data))
 		{
 			case MSG_COMPILER:
-			{	/* single click in the compiler treeview */
-				msgwin_goto_compiler_file_line(event->keyval);
+			{	/* key press in the compiler treeview */
+				msgwin_goto_compiler_file_line(enter_or_return);
 				break;
 			}
 			case MSG_MESSAGE:
-			{	/* single click in the message treeview (results of 'Find usage') */
-				msgwin_goto_messages_file_line(event->keyval);
+			{	/* key press in the message treeview (results of 'Find usage') */
+				msgwin_goto_messages_file_line(enter_or_return);
 				break;
 			}
 		}
@@ -194,6 +196,9 @@
 	 * (connect_after button-press-event doesn't work) */
 	g_signal_connect(msgwindow.tree_msg, "button-release-event",
 					G_CALLBACK(on_msgwin_button_press_event), GINT_TO_POINTER(MSG_MESSAGE));
+	/* for double-clicking only, after the first release */
+	g_signal_connect(msgwindow.tree_msg, "button-press-event",
+					G_CALLBACK(on_msgwin_button_press_event), GINT_TO_POINTER(MSG_MESSAGE));
 	g_signal_connect(msgwindow.tree_msg, "key-press-event",
 		G_CALLBACK(on_msgwin_key_press_event), GINT_TO_POINTER(MSG_MESSAGE));
 
@@ -227,6 +232,9 @@
 	 * (connect_after button-press-event doesn't work) */
 	g_signal_connect(msgwindow.tree_compiler, "button-release-event",
 					G_CALLBACK(on_msgwin_button_press_event), GINT_TO_POINTER(MSG_COMPILER));
+	/* for double-clicking only, after the first release */
+	g_signal_connect(msgwindow.tree_compiler, "button-press-event",
+					G_CALLBACK(on_msgwin_button_press_event), GINT_TO_POINTER(MSG_COMPILER));
 	g_signal_connect(msgwindow.tree_compiler, "key-press-event",
 		G_CALLBACK(on_msgwin_key_press_event), GINT_TO_POINTER(MSG_COMPILER));
 
@@ -622,7 +630,7 @@
 }
 
 
-static gboolean goto_compiler_file_line(const gchar *filename, gint line, guint keyval)
+static gboolean goto_compiler_file_line(const gchar *filename, gint line, gboolean focus_editor)
 {
 	if (!filename || line <= -1)
 		return FALSE;
@@ -672,7 +680,7 @@
 				editor_indicator_set_on_line(doc->editor, GEANY_INDICATOR_ERROR, line - 1);
 
 			ret = navqueue_goto_line(old_doc, doc, line);
-			if (ret && ui_is_keyval_enter_or_return(keyval))
+			if (ret && focus_editor)
 				gtk_widget_grab_focus(GTK_WIDGET(doc->editor->sci));
 
 			return ret;
@@ -682,7 +690,7 @@
 }
 
 
-gboolean msgwin_goto_compiler_file_line(guint keyval)
+gboolean msgwin_goto_compiler_file_line(gboolean focus_editor)
 {
 	GtkTreeIter iter;
 	GtkTreeModel *model;
@@ -718,7 +726,7 @@
 			g_free(string);
 			g_free(dir);
 
-			ret = goto_compiler_file_line(filename, line, keyval);
+			ret = goto_compiler_file_line(filename, line, focus_editor);
 			g_free(filename);
 			return ret;
 		}
@@ -1040,7 +1048,7 @@
 }
 
 
-gboolean msgwin_goto_messages_file_line(guint keyval)
+gboolean msgwin_goto_messages_file_line(gboolean focus_editor)
 {
 	GtkTreeIter iter;
 	GtkTreeModel *model;
@@ -1060,7 +1068,7 @@
 		if (line >= 0 && DOC_VALID(doc))
 		{
 			ret = navqueue_goto_line(old_doc, doc, line);
-			if (ret && ui_is_keyval_enter_or_return(keyval))
+			if (ret && focus_editor)
 				gtk_widget_grab_focus(GTK_WIDGET(doc->editor->sci));
 		}
 		else if (line < 0 && string != NULL)
@@ -1076,7 +1084,7 @@
 				if (doc != NULL)
 				{
 					ret = (line < 0) ? TRUE : navqueue_goto_line(old_doc, doc, line);
-					if (ret && ui_is_keyval_enter_or_return(keyval))
+					if (ret && focus_editor)
 						gtk_widget_grab_focus(GTK_WIDGET(doc->editor->sci));
 				}
 			}
@@ -1092,22 +1100,24 @@
 											 gpointer user_data)
 {
 	/* user_data might be NULL, GPOINTER_TO_INT returns 0 if called with NULL */
+	gboolean double_click = event->type == GDK_2BUTTON_PRESS;
 
-	if (event->button == 1)
+	if (event->button == 1 && (event->type == GDK_BUTTON_RELEASE || double_click))
 	{
 		switch (GPOINTER_TO_INT(user_data))
 		{
 			case MSG_COMPILER:
-			{	/* single click in the compiler treeview */
-				msgwin_goto_compiler_file_line(0);
+			{	/* mouse click in the compiler treeview */
+				msgwin_goto_compiler_file_line(double_click);
 				break;
 			}
 			case MSG_MESSAGE:
-			{	/* single click in the message treeview (results of 'Find usage') */
-				msgwin_goto_messages_file_line(0);
+			{	/* mouse click in the message treeview (results of 'Find usage') */
+				msgwin_goto_messages_file_line(double_click);
 				break;
 			}
 		}
+		return double_click;	/* TRUE prevents message window re-focusing */
 	}
 
 	if (event->button == 3)
--- ./src/msgwindow.h.orig	2011-01-21 20:15:58.000000000 +0200
+++ ./src/msgwindow.h	2011-08-06 19:41:59.000000000 +0300
@@ -96,11 +96,11 @@
 
 void msgwin_menu_add_common_items(GtkMenu *menu);
 
-gboolean msgwin_goto_compiler_file_line(guint keyval);
+gboolean msgwin_goto_compiler_file_line(gboolean focus_editor);
 
 void msgwin_parse_compiler_error_line(const gchar *string, const gchar *dir,
 									  gchar **filename, gint *line);
 
-gboolean msgwin_goto_messages_file_line(guint keyval);
+gboolean msgwin_goto_messages_file_line(gboolean focus_editor);
 
 #endif
--- ./src/ui_utils.c.orig	2011-07-30 14:02:30.000000000 +0300
+++ ./src/ui_utils.c	2011-08-06 19:34:27.000000000 +0300
@@ -1619,7 +1619,7 @@
 	while (TRUE)
 	{
 		gtk_tree_selection_select_iter(treesel, &iter);
-		if (cb(0))
+		if (cb(FALSE))
 			break;	/* found next message */
 
 		if (! tree_model_iter_get_next(model, &iter, down))
--- ./src/ui_utils.h.orig	2011-06-15 19:00:26.000000000 +0300
+++ ./src/ui_utils.h	2011-08-06 19:34:27.000000000 +0300
@@ -298,7 +298,7 @@
 void ui_update_tab_status(GeanyDocument *doc);
 
 
-typedef gboolean TVMatchCallback(guint);
+typedef gboolean TVMatchCallback(gboolean);
 
 gboolean ui_tree_view_find_next(GtkTreeView *treeview, TVMatchCallback cb);
 
