Mercurial > pidgin.yaz
comparison src/gtkimhtml.c @ 4947:24c9a23df63b
[gaim-migrate @ 5281]
You'd think faceprint would have learned the dangers of static variables after
playing with normalize() ;)
This fixes scaling. The problem was that the size of the widget was being
stored in a static variable. Of course, there's more than one gtkimhtml, so
this managed to screw things up a bit.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Tue, 01 Apr 2003 08:43:51 +0000 |
parents | 5fe846b7603f |
children | c307d769cefa |
comparison
equal
deleted
inserted
replaced
4946:154eb3188788 | 4947:24c9a23df63b |
---|---|
54 #define TOOLTIP_TIMEOUT 500 | 54 #define TOOLTIP_TIMEOUT 500 |
55 | 55 |
56 static gboolean gtk_motion_event_notify(GtkWidget *imhtml, GdkEventMotion *event, gpointer user_data); | 56 static gboolean gtk_motion_event_notify(GtkWidget *imhtml, GdkEventMotion *event, gpointer user_data); |
57 static gboolean gtk_leave_event_notify(GtkWidget *imhtml, GdkEventCrossing *event, gpointer user_data); | 57 static gboolean gtk_leave_event_notify(GtkWidget *imhtml, GdkEventCrossing *event, gpointer user_data); |
58 | 58 |
59 static gboolean gtk_size_allocate_cb(GtkWidget *widget, GtkAllocation *alloc, gpointer user_data); | 59 static gboolean gtk_size_allocate_cb(GtkIMHtml *widget, GtkAllocation *alloc, gpointer user_data); |
60 static gint gtk_imhtml_tip (gpointer data); | 60 static gint gtk_imhtml_tip (gpointer data); |
61 | 61 |
62 | 62 |
63 /* POINT_SIZE converts from AIM font sizes to point sizes. It probably should be redone in such a | 63 /* POINT_SIZE converts from AIM font sizes to point sizes. It probably should be redone in such a |
64 * way that it base the sizes off the default font size rather than using arbitrary font sizes. */ | 64 * way that it base the sizes off the default font size rather than using arbitrary font sizes. */ |
1393 g_object_unref(layout); | 1393 g_object_unref(layout); |
1394 | 1394 |
1395 return FALSE; | 1395 return FALSE; |
1396 } | 1396 } |
1397 | 1397 |
1398 static gboolean gtk_size_allocate_cb(GtkWidget *widget, GtkAllocation *alloc, gpointer user_data) | 1398 static gboolean gtk_size_allocate_cb(GtkIMHtml *widget, GtkAllocation *alloc, gpointer user_data) |
1399 { | 1399 { |
1400 static GdkRectangle old_rect = {0,0,0,0}; | |
1401 GdkRectangle rect; | 1400 GdkRectangle rect; |
1402 | 1401 |
1403 gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &rect); | 1402 gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &rect); |
1404 | 1403 if(widget->old_rect.width != rect.width || widget->old_rect.height != rect.height){ |
1405 if(old_rect.width && (old_rect.width != rect.width || old_rect.height != rect.height)){ | |
1406 GList *iter = GTK_IMHTML(widget)->scalables; | 1404 GList *iter = GTK_IMHTML(widget)->scalables; |
1407 | 1405 |
1408 while(iter){ | 1406 while(iter){ |
1409 GtkIMHtmlScalable *scale = GTK_IMHTML_SCALABLE(iter->data); | 1407 GtkIMHtmlScalable *scale = GTK_IMHTML_SCALABLE(iter->data); |
1410 scale->scale(scale, rect.width, rect.height); | 1408 scale->scale(scale, rect.width, rect.height); |
1411 | 1409 |
1412 iter = iter->next; | 1410 iter = iter->next; |
1413 } | 1411 } |
1414 } | 1412 } |
1415 | 1413 |
1416 old_rect = rect; | 1414 widget->old_rect = rect; |
1417 return FALSE; | 1415 return FALSE; |
1418 } | 1416 } |
1419 | 1417 |
1420 /* GtkIMHtmlScalable, gaim_im_image, gaim_hr */ | 1418 /* GtkIMHtmlScalable, gaim_im_image, gaim_hr */ |
1421 GtkIMHtmlScalable *gaim_im_image_new(GdkPixbuf *img) | 1419 GtkIMHtmlScalable *gaim_im_image_new(GdkPixbuf *img) |
1500 return GTK_IMHTML_SCALABLE(hr); | 1498 return GTK_IMHTML_SCALABLE(hr); |
1501 } | 1499 } |
1502 | 1500 |
1503 void gaim_hr_scale(GtkIMHtmlScalable *scale, int width, int height) | 1501 void gaim_hr_scale(GtkIMHtmlScalable *scale, int width, int height) |
1504 { | 1502 { |
1505 /* FIXME: we need to figure out why this causes infinite looping | |
1506 gtk_widget_set_size_request(((gaim_hr *)scale)->sep, width, 2); | 1503 gtk_widget_set_size_request(((gaim_hr *)scale)->sep, width, 2); |
1507 */ | |
1508 } | 1504 } |
1509 | 1505 |
1510 void gaim_hr_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter) | 1506 void gaim_hr_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter) |
1511 { | 1507 { |
1512 gaim_hr *hr = (gaim_hr *)scale; | 1508 gaim_hr *hr = (gaim_hr *)scale; |