changeset 1997:1c01a85c0616

[gaim-migrate @ 2007] no border. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 12 Jun 2001 01:45:08 +0000
parents fc0a285c207a
children 00dc6b2df5b6
files src/gtkimhtml.c
diffstat 1 files changed, 28 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkimhtml.c	Tue Jun 12 01:08:12 2001 +0000
+++ b/src/gtkimhtml.c	Tue Jun 12 01:45:08 2001 +0000
@@ -51,7 +51,7 @@
 
 gint font_sizes [] = { 80, 100, 120, 140, 200, 300, 400 };
 
-#define BORDER_SIZE 2
+#define BORDER_SIZE 3
 #define MIN_HEIGHT 20
 #define HR_HEIGHT 2
 #define TOOLTIP_TIMEOUT 500
@@ -236,10 +236,8 @@
 					 &attributes, attributes_mask);
 	gdk_window_set_user_data (widget->window, widget);
 
-	attributes.x = widget->style->klass->xthickness + BORDER_SIZE;
-	attributes.y = widget->style->klass->xthickness + BORDER_SIZE;
-	attributes.width = MAX (1, (gint) widget->allocation.width - (gint) attributes.x * 2);
-	attributes.height = MAX (1, (gint) widget->allocation.height - (gint) attributes.y * 2);
+	attributes.x = 0;
+	attributes.y = 0;
 	attributes.event_mask = gtk_widget_get_events (widget)
 				| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
 				| GDK_POINTER_MOTION_MASK | GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK;
@@ -252,11 +250,9 @@
 
 	gdk_window_set_cursor (widget->window, imhtml->arrow_cursor);
 
-	gdk_window_set_background (widget->window, &widget->style->base [GTK_STATE_NORMAL]);
+	gdk_window_set_background (widget->window, &widget->style->base [GTK_WIDGET_STATE (widget)]);
 	gdk_window_set_background (GTK_LAYOUT (imhtml)->bin_window,
-				   &widget->style->base [GTK_STATE_NORMAL]);
-
-	gdk_window_show (GTK_LAYOUT (imhtml)->bin_window);
+				   &widget->style->base [GTK_WIDGET_STATE (widget)]);
 }
 
 static gboolean
@@ -477,31 +473,6 @@
 }
 
 static void
-gtk_imhtml_draw_focus (GtkWidget *widget)
-{
-	GtkIMHtml *imhtml;
-	gint x = 0,
-	     y = 0,
-	     w = 0,
-	     h = 0;
-	
-	imhtml = GTK_IMHTML (widget);
-
-	if (!GTK_WIDGET_DRAWABLE (widget))
-		return;
-
-	if (GTK_WIDGET_HAS_FOCUS (widget)) {
-		gtk_paint_focus (widget->style, widget->window, NULL, widget, "text", 0, 0,
-				 widget->allocation.width - 1, widget->allocation.height - 1);
-		x = 1; y = 1; w = 2; h = 2;
-	}
-
-	gtk_paint_shadow (widget->style, widget->window, GTK_STATE_NORMAL,
-			  GTK_SHADOW_IN, NULL, widget, "text", x, y,
-			  widget->allocation.width - w, widget->allocation.height - h);
-}
-
-static void
 gtk_imhtml_draw_exposed (GtkIMHtml *imhtml)
 {
 	GList *bits;
@@ -559,8 +530,6 @@
 		}
 		bits = g_list_next (bits);
 	}
-
-	gtk_imhtml_draw_focus (GTK_WIDGET (imhtml));
 }
 
 static void
@@ -601,6 +570,9 @@
 	g_return_val_if_fail (widget != NULL, FALSE);
 	g_return_val_if_fail (GTK_IS_IMHTML (widget), FALSE);
 
+	if (GTK_WIDGET_CLASS (parent_class)->expose_event)
+		(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
+
 	imhtml = GTK_IMHTML (widget);
 	gtk_imhtml_draw_exposed (imhtml);
 
@@ -630,8 +602,8 @@
 		imhtml->urls = g_list_remove (imhtml->urls, imhtml->urls->data);
 	}
 
-	imhtml->x = 0;
-	imhtml->y = 10;
+	imhtml->x = BORDER_SIZE;
+	imhtml->y = BORDER_SIZE + 10;
 	imhtml->llheight = 0;
 	imhtml->llascent = 0;
 
@@ -671,7 +643,6 @@
 	}
 
 	gtk_layout_thaw (GTK_LAYOUT (imhtml));
-	gtk_imhtml_draw_focus (GTK_WIDGET (imhtml));
 }
 
 static void
@@ -691,15 +662,12 @@
 	widget->allocation = *allocation;
 
 	if (GTK_WIDGET_REALIZED (widget)) {
-		gint x = widget->style->klass->xthickness + BORDER_SIZE;
-		gint y = widget->style->klass->ythickness + BORDER_SIZE;
 		gdk_window_move_resize (widget->window,
 					allocation->x, allocation->y,
 					allocation->width, allocation->height);
 		gdk_window_move_resize (layout->bin_window,
-					x, y,
-					MAX (1, (gint) allocation->width - x * 2),
-					MAX (1, (gint) allocation->height - y * 2));
+					0, 0,
+					allocation->width, allocation->height);
 	}
 
 	layout->hadjustment->page_size = allocation->width;
@@ -1090,7 +1058,7 @@
 	if (!imhtml->tip_bit)
 		return FALSE;
 
-	gtk_paint_flat_box (style, imhtml->tip_window->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
+	gtk_paint_flat_box(style, imhtml->tip_window->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
 			   NULL, imhtml->tip_window, "tooltip", 0, 0, -1, -1);
 
 	y = style->font->ascent + 4;
@@ -1552,7 +1520,6 @@
 
 	widget_class->realize = gtk_imhtml_realize;
 	widget_class->draw = gtk_imhtml_draw;
-	widget_class->draw_focus = gtk_imhtml_draw_focus;
 	widget_class->style_set = gtk_imhtml_style_set;
 	widget_class->expose_event  = gtk_imhtml_expose_event;
 	widget_class->size_allocate = gtk_imhtml_size_allocate;
@@ -1822,8 +1789,8 @@
 	imhtml->bits = NULL;
 	imhtml->urls = NULL;
 
-	imhtml->x = 0;
-	imhtml->y = 10;
+	imhtml->x = BORDER_SIZE;
+	imhtml->y = BORDER_SIZE + 10;
 	imhtml->llheight = 0;
 	imhtml->llascent = 0;
 	imhtml->line = NULL;
@@ -1926,8 +1893,8 @@
 
 	if (last) {
 		li = last->data;
-		if (li->x + li->width != imhtml->xsize)
-			li->width = imhtml->xsize - li->x;
+		if (li->x + li->width != imhtml->xsize - BORDER_SIZE)
+			li->width = imhtml->xsize - BORDER_SIZE - li->x;
 	}
 
 	last = imhtml->line;
@@ -1949,7 +1916,7 @@
 	g_list_free (imhtml->line);
 	imhtml->line = NULL;
 
-	imhtml->x = 0;
+	imhtml->x = BORDER_SIZE;
 	imhtml->y += imhtml->llheight;
 	imhtml->llheight = 0;
 	imhtml->llascent = 0;
@@ -2091,9 +2058,9 @@
 		height = bit->font->ascent + bit->font->descent;
 		width = gdk_string_width (bit->font, bit->text);
 
-		if ((imhtml->x != 0) &&
-				((imhtml->x + width + 5) > imhtml->xsize)) {
-			gint remain = imhtml->xsize - imhtml->x - 5;
+		if ((imhtml->x != BORDER_SIZE) &&
+				((imhtml->x + width + BORDER_SIZE + BORDER_SIZE + 5) > imhtml->xsize)) {
+			gint remain = imhtml->xsize - imhtml->x - BORDER_SIZE - BORDER_SIZE - 5;
 			while (gdk_text_width (bit->font, copy, pos) < remain) {
 				if (copy [pos] == ' ')
 					seenspace = TRUE;
@@ -2116,9 +2083,9 @@
 
 		while (pos < strlen (bit->text)) {
 			width = gdk_string_width (bit->font, copy + pos);
-			if (imhtml->x + width + 5 > imhtml->xsize) {
+			if (imhtml->x + width + BORDER_SIZE + BORDER_SIZE + 5 > imhtml->xsize) {
 				gint newpos = 0;
-				gint remain = imhtml->xsize - imhtml->x - 5;
+				gint remain = imhtml->xsize - imhtml->x - BORDER_SIZE - BORDER_SIZE - 5;
 				while (gdk_text_width (bit->font, copy + pos, newpos) < remain) {
 					if (copy [pos + newpos] == ' ')
 						seenspace = TRUE;
@@ -2155,8 +2122,8 @@
 	} else if ((bit->type == TYPE_SMILEY) || (bit->type == TYPE_IMG)) {
 		gdk_window_get_size (bit->pm, &width, &height);
 
-		if ((imhtml->x != 0) &&
-				((imhtml->x + width + 5) > imhtml->xsize))
+		if ((imhtml->x != BORDER_SIZE) &&
+				((imhtml->x + width + BORDER_SIZE + BORDER_SIZE + 5) > imhtml->xsize))
 			new_line (imhtml);
 		else
 			backwards_update (imhtml, bit, height, 0);
@@ -2173,7 +2140,7 @@
 		li = g_new0 (struct line_info, 1);
 		li->x = imhtml->x;
 		li->y = imhtml->y;
-		li->width = imhtml->xsize;
+		li->width = imhtml->xsize - BORDER_SIZE - BORDER_SIZE;
 		li->height = HR_HEIGHT * 2;
 		li->ascent = 0;
 		li->text = NULL;
@@ -3329,8 +3296,8 @@
 
 	gdk_window_set_cursor (GTK_LAYOUT (imhtml)->bin_window, imhtml->arrow_cursor);
 
-	imhtml->x = 0;
-	imhtml->y = 10;
+	imhtml->x = BORDER_SIZE;
+	imhtml->y = BORDER_SIZE + 10;
 	imhtml->llheight = 0;
 	imhtml->llascent = 0;
 	imhtml->line = NULL;