summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/Makefile.am4
-rw-r--r--src/fe-gtk/servlistgui.c24
-rw-r--r--src/fe-gtk/xtext.c38
3 files changed, 55 insertions, 11 deletions
diff --git a/src/fe-gtk/Makefile.am b/src/fe-gtk/Makefile.am
index 2e95232e..5a622fa0 100644
--- a/src/fe-gtk/Makefile.am
+++ b/src/fe-gtk/Makefile.am
@@ -14,6 +14,10 @@ EXTRA_DIST = \
 	sexy-spell-entry.h sexy-marshal.h textgui.h urlgrab.h userlistgui.h xtext.h \
 	../../data/hexchat.gresource.xml
 
+BUILT_SOURCES = resources.c
+
+CLEANFILES = $(BUILT_SOURCES)
+
 if DO_PLUGIN
 plugingui_c = plugingui.c
 endif
diff --git a/src/fe-gtk/servlistgui.c b/src/fe-gtk/servlistgui.c
index 7a9ee8a1..389607d0 100644
--- a/src/fe-gtk/servlistgui.c
+++ b/src/fe-gtk/servlistgui.c
@@ -944,6 +944,7 @@ static int
 servlist_savegui (void)
 {
 	char *sp;
+	const char *nick1, *nick2;
 
 	/* check for blank username, ircd will not allow this */
 	if (gtk_entry_get_text (GTK_ENTRY (entry_guser))[0] == 0)
@@ -952,8 +953,15 @@ servlist_savegui (void)
 	/* if (gtk_entry_get_text (GTK_ENTRY (entry_greal))[0] == 0)
 		return 1; */
 
-	strcpy (prefs.hex_irc_nick1, gtk_entry_get_text (GTK_ENTRY (entry_nick1)));
-	strcpy (prefs.hex_irc_nick2, gtk_entry_get_text (GTK_ENTRY (entry_nick2)));
+	nick1 = gtk_entry_get_text (GTK_ENTRY (entry_nick1));
+	nick2 = gtk_entry_get_text (GTK_ENTRY (entry_nick2));
+
+	/* ensure unique nicknames */
+	if (!rfc_casecmp (nick1, nick2))
+		return 2;
+
+	strcpy (prefs.hex_irc_nick1, nick1);
+	strcpy (prefs.hex_irc_nick2, nick2);
 	strcpy (prefs.hex_irc_nick3, gtk_entry_get_text (GTK_ENTRY (entry_nick3)));
 	strcpy (prefs.hex_irc_user_name, gtk_entry_get_text (GTK_ENTRY (entry_guser)));
 	sp = strchr (prefs.hex_irc_user_name, ' ');
@@ -1104,12 +1112,20 @@ servlist_toggle_global_user (gboolean sensitive)
 static void
 servlist_connect_cb (GtkWidget *button, gpointer userdata)
 {
+	int servlist_err;
+
 	if (!selected_net)
 		return;
 
-	if (servlist_savegui () != 0)
+	servlist_err = servlist_savegui ();
+	if (servlist_err == 1)
+	{
+		fe_message (_("User name cannot be left blank."), FE_MSG_ERROR);
+		return;
+	}
+	else if (servlist_err == 2)
 	{
-		fe_message (_("User name and Real name cannot be left blank."), FE_MSG_ERROR);
+		fe_message (_("You must have a unique nickname for Second Choice."), FE_MSG_ERROR);
 		return;
 	}
 
diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c
index 7010ac46..52751b69 100644
--- a/src/fe-gtk/xtext.c
+++ b/src/fe-gtk/xtext.c
@@ -857,7 +857,10 @@ gtk_xtext_find_x (GtkXText * xtext, int x, textentry * ent, int subline,
 		indent = xtext->buffer->indent;
 
 	if (line > xtext->adj->page_size || line < 0)
+	{
+		*out_of_bounds = TRUE;
 		return 0;
+	}
 
 	if (xtext->buffer->grid_dirty || line > 255)
 	{
@@ -890,6 +893,10 @@ gtk_xtext_find_char (GtkXText * xtext, int x, int y, int *off,
 	int line;
 	int subline;
 
+	/* Adjust y value for negative rounding, double to int */
+	if (y < 0)
+		y -= xtext->fontsize;
+
 	line = (y + xtext->pixel_offset) / xtext->fontsize;
 	ent = gtk_xtext_nth (xtext, line + (int)xtext->adj->value, &subline);
 	if (!ent)
@@ -1270,6 +1277,9 @@ gtk_xtext_selection_draw (GtkXText * xtext, GdkEventMotion * event, gboolean ren
 			gtk_xtext_render_page (xtext);
 		return;
 	}
+	else if (tmp) {
+		offset_start = xtext->buffer->last_offset_start;
+	}
 
 	ent_end = gtk_xtext_find_char (xtext, high_x, high_y, &offset_end, &tmp);
 	if (!ent_end)
@@ -1283,6 +1293,10 @@ gtk_xtext_selection_draw (GtkXText * xtext, GdkEventMotion * event, gboolean ren
 		}
 		offset_end = ent_end->str_len;
 	}
+	else if (tmp)
+	{
+		offset_end = xtext->buffer->last_offset_end;
+	}
 
 	/* marking less than a complete line? */
 	/* make sure "start" is smaller than "end" (swap them if need be) */
@@ -1317,6 +1331,11 @@ gtk_xtext_selection_draw (GtkXText * xtext, GdkEventMotion * event, gboolean ren
 			ent = ent->next;
 		}
 	}
+	else
+	{
+		if (xtext->mark_stamp)
+			offset_start = 0;
+	}
 
 	if (render)
 		gtk_xtext_selection_render (xtext, ent_start, offset_start, ent_end, offset_end);
@@ -1351,7 +1370,6 @@ gtk_xtext_scrolldown_timeout (GtkXText * xtext)
 		return 0;
 	}
 
-	adj->value = (int)adj->value;	/* Align to line boundary */
 	xtext->select_start_y -= xtext->fontsize;
 	xtext->select_start_adj++;
 	adj->value++;
@@ -1372,6 +1390,7 @@ gtk_xtext_scrollup_timeout (GtkXText * xtext)
 	int p_y;
 	xtext_buffer *buf = xtext->buffer;
 	GtkAdjustment *adj = xtext->adj;
+	int delta_y;
 
 	gdk_window_get_pointer (GTK_WIDGET (xtext)->window, 0, &p_y, 0);
 
@@ -1384,10 +1403,16 @@ gtk_xtext_scrollup_timeout (GtkXText * xtext)
 		return 0;
 	}
 
-	adj->value = (int)adj->value;	/* Align to line boundary */
-	xtext->select_start_y += xtext->fontsize;
-	xtext->select_start_adj--;
-	adj->value--;
+	if (adj->value < 0)
+	{
+		delta_y = adj->value * xtext->fontsize;
+		adj->value = 0;
+	} else {
+		delta_y = xtext->fontsize;
+		adj->value--;
+	}
+	xtext->select_start_y += delta_y;
+	xtext->select_start_adj = adj->value;
 	gtk_adjustment_value_changed (adj);
 	gtk_xtext_selection_draw (xtext, NULL, TRUE);
 	gtk_xtext_render_ents (xtext, buf->pagetop_ent->prev, buf->last_ent_end);
@@ -1793,10 +1818,9 @@ gtk_xtext_unselect (GtkXText *xtext)
 	gtk_xtext_selection_clear (xtext->buffer);
 
 	/* FIXME: use jump_out on multi-line selects too! */
-	gtk_xtext_render_ents (xtext, buf->last_ent_start, buf->last_ent_end);
-
 	xtext->jump_in_offset = 0;
 	xtext->jump_out_offset = 0;
+	gtk_xtext_render_ents (xtext, buf->last_ent_start, buf->last_ent_end);
 
 	xtext->skip_border_fills = FALSE;
 	xtext->skip_stamp = FALSE;